mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Remove AttributeLintKind::DocAutoCfgHideShowExpectsList variant
This commit is contained in:
@@ -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<S: Stage>(
|
||||
}
|
||||
};
|
||||
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;
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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 } => {
|
||||
|
||||
@@ -3303,12 +3303,6 @@ fn add_to_diag<G: EmissionGuarantee>(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;
|
||||
|
||||
@@ -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 },
|
||||
|
||||
Reference in New Issue
Block a user