Remove AttributeLintKind::DocUnknownAny variant

This commit is contained in:
Guillaume Gomez
2026-04-20 16:54:15 +02:00
parent 0ad35a24fd
commit 1aee0e07b4
5 changed files with 13 additions and 17 deletions
@@ -15,8 +15,8 @@
use crate::context::{AcceptContext, FinalizeContext, Stage};
use crate::errors::{
DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, DocAutoCfgHideShowExpectsList,
DocAutoCfgHideShowUnexpectedItem, DocUnknownInclude, DocUnknownPasses, DocUnknownPlugins,
DocUnknownSpotlight, IllFormedAttributeInput,
DocAutoCfgHideShowUnexpectedItem, DocUnknownAny, DocUnknownInclude, DocUnknownPasses,
DocUnknownPlugins, DocUnknownSpotlight, IllFormedAttributeInput,
};
use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser};
use crate::session_diagnostics::{
@@ -660,18 +660,19 @@ macro_rules! string_arg_and_crate_level {
);
}
Some(name) => {
cx.emit_lint(
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::DocUnknownAny { name },
move |dcx, level| DocUnknownAny { name }.into_diag(dcx, level),
path.span(),
);
}
None => {
let full_name =
path.segments().map(|s| s.as_str()).intersperse("::").collect::<String>();
cx.emit_lint(
let name = Symbol::intern(&full_name);
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::DocUnknownAny { name: Symbol::intern(&full_name) },
move |dcx, level| DocUnknownAny { name }.into_diag(dcx, level),
path.span(),
);
}
@@ -242,3 +242,9 @@ pub(crate) struct DocUnknownPlugins {
#[label("no longer functions")]
pub label_span: Span,
}
#[derive(Diagnostic)]
#[diag("unknown `doc` attribute `{$name}`")]
pub(crate) struct DocUnknownAny {
pub name: Symbol,
}
@@ -43,10 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
.into_diag(dcx, level)
}
&AttributeLintKind::DocUnknownAny { name } => {
lints::DocUnknownAny { name }.into_diag(dcx, level)
}
&AttributeLintKind::DocAutoCfgWrongLiteral => {
lints::DocAutoCfgWrongLiteral.into_diag(dcx, level)
}
-6
View File
@@ -3303,12 +3303,6 @@ fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
)]
pub(crate) struct ExpectedNameValue;
#[derive(Diagnostic)]
#[diag("unknown `doc` attribute `{$name}`")]
pub(crate) struct DocUnknownAny {
pub name: Symbol,
}
#[derive(Diagnostic)]
#[diag("expected boolean for `#[doc(auto_cfg = ...)]`")]
pub(crate) struct DocAutoCfgWrongLiteral;
-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)>),
DocUnknownAny { name: Symbol },
DocAutoCfgWrongLiteral,
DocTestTakesList,
DocTestUnknown { name: Symbol },