Remove AttributeLintKind::MalformedDoc variant

This commit is contained in:
Guillaume Gomez
2026-04-22 23:16:12 +02:00
parent 827651f220
commit 359910e21e
5 changed files with 16 additions and 18 deletions
@@ -18,6 +18,7 @@
DocAutoCfgHideShowExpectsList, DocAutoCfgHideShowUnexpectedItem, DocAutoCfgWrongLiteral,
DocTestLiteral, DocTestTakesList, DocTestUnknown, DocUnknownAny, DocUnknownInclude,
DocUnknownPasses, DocUnknownPlugins, DocUnknownSpotlight, IllFormedAttributeInput,
MalformedDoc,
};
use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser};
use crate::session_diagnostics::{
@@ -107,9 +108,9 @@ fn expected_string_literal<S: Stage>(
span: Span,
_actual_literal: Option<&MetaItemLit>,
) {
cx.emit_lint(
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::MalformedDoc,
|dcx, level| MalformedDoc.into_diag(dcx, level),
span,
);
}
@@ -203,9 +204,9 @@ fn parse_single_test_doc_attr_item<S: Stage>(
// FIXME: remove this method once merged and uncomment the line below instead.
// cx.expected_list(cx.attr_span, args);
let span = cx.attr_span;
cx.emit_lint(
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::MalformedDoc,
|dcx, level| MalformedDoc.into_diag(dcx, level),
span,
);
return;
@@ -399,9 +400,9 @@ fn parse_auto_cfg<S: Stage>(
// FIXME: remove this method once merged and uncomment the line
// below instead.
// cx.expected_identifier(sub_item.path().span());
cx.emit_lint(
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::MalformedDoc,
|dcx, level| MalformedDoc.into_diag(dcx, level),
sub_item.path().span(),
);
continue;
@@ -605,9 +606,9 @@ macro_rules! string_arg_and_crate_level {
// FIXME: remove this method once merged and uncomment the line
// below instead.
// cx.unexpected_literal(lit.span);
cx.emit_lint(
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::MalformedDoc,
|dcx, level| MalformedDoc.into_diag(dcx, level),
lit.span,
);
}
@@ -325,3 +325,10 @@ pub(crate) struct IncorrectDoNotRecommendLocation {
#[label("not a trait implementation")]
pub target_span: Span,
}
#[derive(Diagnostic)]
#[diag("malformed `doc` attribute input")]
#[warning(
"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
)]
pub(crate) struct MalformedDoc;
@@ -43,8 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
.into_diag(dcx, level)
}
&AttributeLintKind::MalformedDoc => lints::MalformedDoc.into_diag(dcx, level),
&AttributeLintKind::ExpectedNoArgs => lints::ExpectedNoArgs.into_diag(dcx, level),
&AttributeLintKind::ExpectedNameValue => lints::ExpectedNameValue.into_diag(dcx, level),
-7
View File
@@ -3282,13 +3282,6 @@ fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
}
}
#[derive(Diagnostic)]
#[diag("malformed `doc` attribute input")]
#[warning(
"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
)]
pub(crate) struct MalformedDoc;
#[derive(Diagnostic)]
#[diag("didn't expect any arguments here")]
#[warning(
-1
View File
@@ -656,7 +656,6 @@ pub enum DeprecatedSinceKind {
pub enum AttributeLintKind {
UnexpectedCfgName((Symbol, Span), Option<(Symbol, Span)>),
UnexpectedCfgValue((Symbol, Span), Option<(Symbol, Span)>),
MalformedDoc,
ExpectedNoArgs,
ExpectedNameValue,
MalFormedDiagnosticAttribute { attribute: &'static str, options: &'static str, span: Span },