From ace320fba3df37d7d33aefb80bb7734971bf3264 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 20 Apr 2026 00:50:55 +0200 Subject: [PATCH 1/5] Remove `AttributeLintKind::AmbiguousDeriveHelpers` variant --- .../rustc_attr_parsing/src/attributes/proc_macro_attrs.rs | 6 +++--- compiler/rustc_attr_parsing/src/errors.rs | 4 ++++ compiler/rustc_lint/src/early/diagnostics.rs | 4 ---- compiler/rustc_lint/src/lints.rs | 4 ---- compiler/rustc_lint_defs/src/lib.rs | 1 - 5 files changed, 7 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs b/compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs index 7cb59856b8a2..76dc171c6831 100644 --- a/compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs +++ b/compiler/rustc_attr_parsing/src/attributes/proc_macro_attrs.rs @@ -1,4 +1,4 @@ -use rustc_hir::lints::AttributeLintKind; +use rustc_errors::Diagnostic; use rustc_session::lint::builtin::AMBIGUOUS_DERIVE_HELPERS; use super::prelude::*; @@ -125,9 +125,9 @@ fn parse_derive_like( return None; } if rustc_feature::is_builtin_attr_name(ident.name) { - cx.emit_lint( + cx.emit_dyn_lint( AMBIGUOUS_DERIVE_HELPERS, - AttributeLintKind::AmbiguousDeriveHelpers, + |dcx, level| crate::errors::AmbiguousDeriveHelpers.into_diag(dcx, level), ident.span, ); } diff --git a/compiler/rustc_attr_parsing/src/errors.rs b/compiler/rustc_attr_parsing/src/errors.rs index 8148a859958b..24cff14e17d8 100644 --- a/compiler/rustc_attr_parsing/src/errors.rs +++ b/compiler/rustc_attr_parsing/src/errors.rs @@ -177,3 +177,7 @@ pub(crate) struct DocAliasDuplicated { #[derive(Diagnostic)] #[diag("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")] pub(crate) struct DocAutoCfgExpectsHideOrShow; + +#[derive(Diagnostic)] +#[diag("there exists a built-in attribute with the same name")] +pub(crate) struct AmbiguousDeriveHelpers; diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs index fb59cd35ad46..24ddef1c14eb 100644 --- a/compiler/rustc_lint/src/early/diagnostics.rs +++ b/compiler/rustc_lint/src/early/diagnostics.rs @@ -43,10 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { .into_diag(dcx, level) } - &AttributeLintKind::AmbiguousDeriveHelpers => { - lints::AmbiguousDeriveHelpers.into_diag(dcx, level) - } - &AttributeLintKind::DocAutoCfgHideShowUnexpectedItem { attr_name } => { lints::DocAutoCfgHideShowUnexpectedItem { attr_name }.into_diag(dcx, level) } diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index b92efc408ae8..93f32104bcf1 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -3303,10 +3303,6 @@ fn add_to_diag(self, diag: &mut Diag<'_, G>) { )] pub(crate) struct ExpectedNameValue; -#[derive(Diagnostic)] -#[diag("there exists a built-in attribute with the same name")] -pub(crate) struct AmbiguousDeriveHelpers; - #[derive(Diagnostic)] #[diag("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items")] pub(crate) struct DocAutoCfgHideShowUnexpectedItem { diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index 29da46770d52..24991ac03e98 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -659,7 +659,6 @@ pub enum AttributeLintKind { DocAutoCfgHideShowUnexpectedItem { attr_name: Symbol }, DocAutoCfgHideShowExpectsList { attr_name: Symbol }, DocInvalid, - AmbiguousDeriveHelpers, DocUnknownInclude { span: Span, inner: &'static str, value: Symbol }, DocUnknownSpotlight { span: Span }, DocUnknownPasses { name: Symbol, span: Span }, From d7d9cf91535bccf32e68b53d2c970e12331d0401 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 20 Apr 2026 01:59:03 +0200 Subject: [PATCH 2/5] Remove `AttributeLintKind::DocAutoCfgHideShowUnexpectedItem` variant --- .../rustc_attr_parsing/src/attributes/doc.rs | 19 +++++++++++++------ compiler/rustc_attr_parsing/src/errors.rs | 6 ++++++ compiler/rustc_lint/src/early/diagnostics.rs | 4 ---- compiler/rustc_lint/src/lints.rs | 6 ------ compiler/rustc_lint_defs/src/lib.rs | 1 - 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/attributes/doc.rs b/compiler/rustc_attr_parsing/src/attributes/doc.rs index 665c516c3e8e..572093b87344 100644 --- a/compiler/rustc_attr_parsing/src/attributes/doc.rs +++ b/compiler/rustc_attr_parsing/src/attributes/doc.rs @@ -13,7 +13,10 @@ use super::prelude::{ALL_TARGETS, AllowedTargets}; use super::{AcceptMapping, AttributeParser}; use crate::context::{AcceptContext, FinalizeContext, Stage}; -use crate::errors::{DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, IllFormedAttributeInput}; +use crate::errors::{ + DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, DocAutoCfgHideShowUnexpectedItem, + IllFormedAttributeInput, +}; use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser}; use crate::session_diagnostics::{ DocAliasBadChar, DocAliasEmpty, DocAliasMalformed, DocAliasStartEnd, DocAttrNotCrateLevel, @@ -376,9 +379,12 @@ fn parse_auto_cfg( for item in list.mixed() { let MetaItemOrLitParser::MetaItemParser(sub_item) = item else { - cx.emit_lint( + cx.emit_dyn_lint( rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES, - AttributeLintKind::DocAutoCfgHideShowUnexpectedItem { attr_name }, + move |dcx, level| { + DocAutoCfgHideShowUnexpectedItem { attr_name } + .into_diag(dcx, level) + }, item.span(), ); continue; @@ -416,10 +422,11 @@ fn parse_auto_cfg( } } _ => { - cx.emit_lint( + cx.emit_dyn_lint( rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES, - AttributeLintKind::DocAutoCfgHideShowUnexpectedItem { - attr_name, + move |dcx, level| { + DocAutoCfgHideShowUnexpectedItem { attr_name } + .into_diag(dcx, level) }, sub_item.span(), ); diff --git a/compiler/rustc_attr_parsing/src/errors.rs b/compiler/rustc_attr_parsing/src/errors.rs index 24cff14e17d8..18cc59ad6955 100644 --- a/compiler/rustc_attr_parsing/src/errors.rs +++ b/compiler/rustc_attr_parsing/src/errors.rs @@ -181,3 +181,9 @@ pub(crate) struct DocAliasDuplicated { #[derive(Diagnostic)] #[diag("there exists a built-in attribute with the same name")] pub(crate) struct AmbiguousDeriveHelpers; + +#[derive(Diagnostic)] +#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items")] +pub(crate) struct DocAutoCfgHideShowUnexpectedItem { + pub attr_name: Symbol, +} diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs index 24ddef1c14eb..43f185f6b23c 100644 --- a/compiler/rustc_lint/src/early/diagnostics.rs +++ b/compiler/rustc_lint/src/early/diagnostics.rs @@ -43,10 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { .into_diag(dcx, level) } - &AttributeLintKind::DocAutoCfgHideShowUnexpectedItem { attr_name } => { - lints::DocAutoCfgHideShowUnexpectedItem { attr_name }.into_diag(dcx, level) - } - &AttributeLintKind::DocAutoCfgHideShowExpectsList { attr_name } => { lints::DocAutoCfgHideShowExpectsList { attr_name }.into_diag(dcx, level) } diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 93f32104bcf1..3698976fd6e6 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -3303,12 +3303,6 @@ fn add_to_diag(self, diag: &mut Diag<'_, G>) { )] pub(crate) struct ExpectedNameValue; -#[derive(Diagnostic)] -#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` only accepts identifiers or key/value items")] -pub(crate) struct DocAutoCfgHideShowUnexpectedItem { - pub attr_name: Symbol, -} - #[derive(Diagnostic)] #[diag("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")] pub(crate) struct DocAutoCfgHideShowExpectsList { diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index 24991ac03e98..466b9ac0deed 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -656,7 +656,6 @@ pub enum DeprecatedSinceKind { pub enum AttributeLintKind { UnexpectedCfgName((Symbol, Span), Option<(Symbol, Span)>), UnexpectedCfgValue((Symbol, Span), Option<(Symbol, Span)>), - DocAutoCfgHideShowUnexpectedItem { attr_name: Symbol }, DocAutoCfgHideShowExpectsList { attr_name: Symbol }, DocInvalid, DocUnknownInclude { span: Span, inner: &'static str, value: Symbol }, From dacc42fb1b51f0116d95835d78b711b17e372c4e Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 20 Apr 2026 02:08:18 +0200 Subject: [PATCH 3/5] Remove `AttributeLintKind::DocAutoCfgHideShowExpectsList` variant --- compiler/rustc_attr_parsing/src/attributes/doc.rs | 10 ++++++---- compiler/rustc_attr_parsing/src/errors.rs | 6 ++++++ compiler/rustc_lint/src/early/diagnostics.rs | 4 ---- compiler/rustc_lint/src/lints.rs | 6 ------ compiler/rustc_lint_defs/src/lib.rs | 1 - 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/attributes/doc.rs b/compiler/rustc_attr_parsing/src/attributes/doc.rs index 572093b87344..ec7119828530 100644 --- a/compiler/rustc_attr_parsing/src/attributes/doc.rs +++ b/compiler/rustc_attr_parsing/src/attributes/doc.rs @@ -14,8 +14,8 @@ use super::{AcceptMapping, AttributeParser}; use crate::context::{AcceptContext, FinalizeContext, Stage}; use crate::errors::{ - DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, DocAutoCfgHideShowUnexpectedItem, - IllFormedAttributeInput, + DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, DocAutoCfgHideShowExpectsList, + DocAutoCfgHideShowUnexpectedItem, IllFormedAttributeInput, }; use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser}; use crate::session_diagnostics::{ @@ -367,9 +367,11 @@ fn parse_auto_cfg( } }; let ArgParser::List(list) = item.args() else { - cx.emit_lint( + cx.emit_dyn_lint( rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES, - AttributeLintKind::DocAutoCfgHideShowExpectsList { attr_name }, + move |dcx, level| { + DocAutoCfgHideShowExpectsList { attr_name }.into_diag(dcx, level) + }, item.span(), ); continue; diff --git a/compiler/rustc_attr_parsing/src/errors.rs b/compiler/rustc_attr_parsing/src/errors.rs index 18cc59ad6955..29bd1f965f62 100644 --- a/compiler/rustc_attr_parsing/src/errors.rs +++ b/compiler/rustc_attr_parsing/src/errors.rs @@ -187,3 +187,9 @@ pub(crate) struct DocAliasDuplicated { pub(crate) struct DocAutoCfgHideShowUnexpectedItem { pub attr_name: Symbol, } + +#[derive(Diagnostic)] +#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")] +pub(crate) struct DocAutoCfgHideShowExpectsList { + pub attr_name: Symbol, +} diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs index 43f185f6b23c..bb88e791979d 100644 --- a/compiler/rustc_lint/src/early/diagnostics.rs +++ b/compiler/rustc_lint/src/early/diagnostics.rs @@ -43,10 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { .into_diag(dcx, level) } - &AttributeLintKind::DocAutoCfgHideShowExpectsList { attr_name } => { - lints::DocAutoCfgHideShowExpectsList { attr_name }.into_diag(dcx, level) - } - &AttributeLintKind::DocInvalid => lints::DocInvalid.into_diag(dcx, level), &AttributeLintKind::DocUnknownInclude { span, inner, value } => { diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 3698976fd6e6..3d98a1270cf8 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -3303,12 +3303,6 @@ fn add_to_diag(self, diag: &mut Diag<'_, G>) { )] pub(crate) struct ExpectedNameValue; -#[derive(Diagnostic)] -#[diag("`#![doc(auto_cfg({$attr_name}(...)))]` expects a list of items")] -pub(crate) struct DocAutoCfgHideShowExpectsList { - pub attr_name: Symbol, -} - #[derive(Diagnostic)] #[diag("invalid `doc` attribute")] pub(crate) struct DocInvalid; diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index 466b9ac0deed..c0dc952a33d9 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -656,7 +656,6 @@ pub enum DeprecatedSinceKind { pub enum AttributeLintKind { UnexpectedCfgName((Symbol, Span), Option<(Symbol, Span)>), UnexpectedCfgValue((Symbol, Span), Option<(Symbol, Span)>), - DocAutoCfgHideShowExpectsList { attr_name: Symbol }, DocInvalid, DocUnknownInclude { span: Span, inner: &'static str, value: Symbol }, DocUnknownSpotlight { span: Span }, From 4b2e2ace2324d99ab9d87088882574d3633943be Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 20 Apr 2026 02:09:33 +0200 Subject: [PATCH 4/5] Remove unused `AttributeLintKind::DocInvalid` variant --- compiler/rustc_lint/src/early/diagnostics.rs | 2 -- compiler/rustc_lint/src/lints.rs | 4 ---- compiler/rustc_lint_defs/src/lib.rs | 1 - 3 files changed, 7 deletions(-) diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs index bb88e791979d..571bc668e80c 100644 --- a/compiler/rustc_lint/src/early/diagnostics.rs +++ b/compiler/rustc_lint/src/early/diagnostics.rs @@ -43,8 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { .into_diag(dcx, level) } - &AttributeLintKind::DocInvalid => lints::DocInvalid.into_diag(dcx, level), - &AttributeLintKind::DocUnknownInclude { span, inner, value } => { lints::DocUnknownInclude { inner, diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 3d98a1270cf8..5d557fffc787 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -3303,10 +3303,6 @@ fn add_to_diag(self, diag: &mut Diag<'_, G>) { )] pub(crate) struct ExpectedNameValue; -#[derive(Diagnostic)] -#[diag("invalid `doc` attribute")] -pub(crate) struct DocInvalid; - #[derive(Diagnostic)] #[diag("unknown `doc` attribute `include`")] pub(crate) struct DocUnknownInclude { diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index c0dc952a33d9..00cc1dceedb1 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -656,7 +656,6 @@ pub enum DeprecatedSinceKind { pub enum AttributeLintKind { UnexpectedCfgName((Symbol, Span), Option<(Symbol, Span)>), UnexpectedCfgValue((Symbol, Span), Option<(Symbol, Span)>), - DocInvalid, DocUnknownInclude { span: Span, inner: &'static str, value: Symbol }, DocUnknownSpotlight { span: Span }, DocUnknownPasses { name: Symbol, span: Span }, From 6d23cf97da2170ab7059beec92c0bd8d475cad38 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 20 Apr 2026 02:23:56 +0200 Subject: [PATCH 5/5] Remove `AttributeLintKind::DocUnknownInclude` variant --- .../rustc_attr_parsing/src/attributes/doc.rs | 21 ++++++++++++------- compiler/rustc_attr_parsing/src/errors.rs | 14 ++++++++++++- compiler/rustc_lint/src/early/diagnostics.rs | 11 +--------- compiler/rustc_lint/src/lints.rs | 12 ----------- compiler/rustc_lint_defs/src/lib.rs | 1 - 5 files changed, 27 insertions(+), 32 deletions(-) diff --git a/compiler/rustc_attr_parsing/src/attributes/doc.rs b/compiler/rustc_attr_parsing/src/attributes/doc.rs index ec7119828530..a5a9596a9e71 100644 --- a/compiler/rustc_attr_parsing/src/attributes/doc.rs +++ b/compiler/rustc_attr_parsing/src/attributes/doc.rs @@ -1,5 +1,5 @@ use rustc_ast::ast::{AttrStyle, LitKind, MetaItemLit}; -use rustc_errors::{Diagnostic, msg}; +use rustc_errors::{Applicability, Diagnostic, msg}; use rustc_feature::template; use rustc_hir::Target; use rustc_hir::attrs::{ @@ -15,7 +15,7 @@ use crate::context::{AcceptContext, FinalizeContext, Stage}; use crate::errors::{ DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, DocAutoCfgHideShowExpectsList, - DocAutoCfgHideShowUnexpectedItem, IllFormedAttributeInput, + DocAutoCfgHideShowUnexpectedItem, DocUnknownInclude, IllFormedAttributeInput, }; use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser}; use crate::session_diagnostics::{ @@ -624,14 +624,19 @@ macro_rules! string_arg_and_crate_level { AttrStyle::Outer => "", AttrStyle::Inner => "!", }; - cx.emit_lint( + let value = nv.value_as_lit().symbol; + let span = path.span(); + cx.emit_dyn_lint( rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES, - AttributeLintKind::DocUnknownInclude { - inner, - value: nv.value_as_lit().symbol, - span: path.span(), + move |dcx, level| { + DocUnknownInclude { + inner, + value, + sugg: (span, Applicability::MaybeIncorrect), + } + .into_diag(dcx, level) }, - path.span(), + span, ); } Some(name @ (sym::passes | sym::no_default_passes)) => { diff --git a/compiler/rustc_attr_parsing/src/errors.rs b/compiler/rustc_attr_parsing/src/errors.rs index 29bd1f965f62..2ba50439c4e3 100644 --- a/compiler/rustc_attr_parsing/src/errors.rs +++ b/compiler/rustc_attr_parsing/src/errors.rs @@ -1,4 +1,4 @@ -use rustc_errors::{DiagArgValue, MultiSpan}; +use rustc_errors::{Applicability, DiagArgValue, MultiSpan}; use rustc_macros::{Diagnostic, Subdiagnostic}; use rustc_span::{Span, Symbol}; @@ -193,3 +193,15 @@ pub(crate) struct DocAutoCfgHideShowUnexpectedItem { pub(crate) struct DocAutoCfgHideShowExpectsList { pub attr_name: Symbol, } + +#[derive(Diagnostic)] +#[diag("unknown `doc` attribute `include`")] +pub(crate) struct DocUnknownInclude { + pub inner: &'static str, + pub value: Symbol, + #[suggestion( + "use `doc = include_str!` instead", + code = "#{inner}[doc = include_str!(\"{value}\")]" + )] + pub sugg: (Span, Applicability), +} diff --git a/compiler/rustc_lint/src/early/diagnostics.rs b/compiler/rustc_lint/src/early/diagnostics.rs index 571bc668e80c..a6a065040420 100644 --- a/compiler/rustc_lint/src/early/diagnostics.rs +++ b/compiler/rustc_lint/src/early/diagnostics.rs @@ -1,7 +1,7 @@ use std::any::Any; use rustc_data_structures::sync::DynSend; -use rustc_errors::{Applicability, Diag, DiagCtxtHandle, Diagnostic, Level}; +use rustc_errors::{Diag, DiagCtxtHandle, Diagnostic, Level}; use rustc_hir::lints::{AttributeLintKind, FormatWarning}; use rustc_middle::ty::TyCtxt; use rustc_session::Session; @@ -43,15 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> { .into_diag(dcx, level) } - &AttributeLintKind::DocUnknownInclude { span, inner, value } => { - lints::DocUnknownInclude { - inner, - value, - sugg: (span, Applicability::MaybeIncorrect), - } - .into_diag(dcx, level) - } - &AttributeLintKind::DocUnknownSpotlight { span } => { lints::DocUnknownSpotlight { sugg_span: span }.into_diag(dcx, level) } diff --git a/compiler/rustc_lint/src/lints.rs b/compiler/rustc_lint/src/lints.rs index 5d557fffc787..8912c8b03fbd 100644 --- a/compiler/rustc_lint/src/lints.rs +++ b/compiler/rustc_lint/src/lints.rs @@ -3303,18 +3303,6 @@ fn add_to_diag(self, diag: &mut Diag<'_, G>) { )] pub(crate) struct ExpectedNameValue; -#[derive(Diagnostic)] -#[diag("unknown `doc` attribute `include`")] -pub(crate) struct DocUnknownInclude { - pub inner: &'static str, - pub value: Symbol, - #[suggestion( - "use `doc = include_str!` instead", - code = "#{inner}[doc = include_str!(\"{value}\")]" - )] - pub sugg: (Span, Applicability), -} - #[derive(Diagnostic)] #[diag("unknown `doc` attribute `spotlight`")] #[note("`doc(spotlight)` was renamed to `doc(notable_trait)`")] diff --git a/compiler/rustc_lint_defs/src/lib.rs b/compiler/rustc_lint_defs/src/lib.rs index 00cc1dceedb1..540e4afc50ff 100644 --- a/compiler/rustc_lint_defs/src/lib.rs +++ b/compiler/rustc_lint_defs/src/lib.rs @@ -656,7 +656,6 @@ pub enum DeprecatedSinceKind { pub enum AttributeLintKind { UnexpectedCfgName((Symbol, Span), Option<(Symbol, Span)>), UnexpectedCfgValue((Symbol, Span), Option<(Symbol, Span)>), - DocUnknownInclude { span: Span, inner: &'static str, value: Symbol }, DocUnknownSpotlight { span: Span }, DocUnknownPasses { name: Symbol, span: Span }, DocUnknownPlugins { span: Span },