mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-27 18:57:42 +03:00
Remove AttributeLintKind::DocAutoCfgExpectsHideOrShow variant
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
use super::prelude::{ALL_TARGETS, AllowedTargets};
|
||||
use super::{AcceptMapping, AttributeParser};
|
||||
use crate::context::{AcceptContext, FinalizeContext, Stage};
|
||||
use crate::errors::{DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, IllFormedAttributeInput};
|
||||
use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser};
|
||||
use crate::session_diagnostics::{
|
||||
DocAliasBadChar, DocAliasEmpty, DocAliasMalformed, DocAliasStartEnd, DocAttrNotCrateLevel,
|
||||
@@ -257,9 +258,7 @@ fn add_alias<S: Stage>(
|
||||
if let Some(first_definition) = self.attribute.aliases.get(&alias).copied() {
|
||||
cx.emit_dyn_lint(
|
||||
rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
|
||||
move |dcx, level| {
|
||||
crate::errors::DocAliasDuplicated { first_definition }.into_diag(dcx, level)
|
||||
},
|
||||
move |dcx, level| DocAliasDuplicated { first_definition }.into_diag(dcx, level),
|
||||
span,
|
||||
);
|
||||
}
|
||||
@@ -345,9 +344,9 @@ fn parse_auto_cfg<S: Stage>(
|
||||
ArgParser::List(list) => {
|
||||
for meta in list.mixed() {
|
||||
let MetaItemOrLitParser::MetaItemParser(item) = meta else {
|
||||
cx.emit_lint(
|
||||
cx.emit_dyn_lint(
|
||||
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
|
||||
AttributeLintKind::DocAutoCfgExpectsHideOrShow,
|
||||
|dcx, level| DocAutoCfgExpectsHideOrShow.into_diag(dcx, level),
|
||||
meta.span(),
|
||||
);
|
||||
continue;
|
||||
@@ -356,9 +355,9 @@ fn parse_auto_cfg<S: Stage>(
|
||||
Some(sym::hide) => (HideOrShow::Hide, sym::hide),
|
||||
Some(sym::show) => (HideOrShow::Show, sym::show),
|
||||
_ => {
|
||||
cx.emit_lint(
|
||||
cx.emit_dyn_lint(
|
||||
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
|
||||
AttributeLintKind::DocAutoCfgExpectsHideOrShow,
|
||||
|dcx, level| DocAutoCfgExpectsHideOrShow.into_diag(dcx, level),
|
||||
item.span(),
|
||||
);
|
||||
continue;
|
||||
@@ -671,8 +670,7 @@ fn accept_single_doc_attr<S: Stage>(
|
||||
cx.emit_dyn_lint(
|
||||
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
|
||||
move |dcx, level| {
|
||||
crate::errors::IllFormedAttributeInput::new(&suggestions, None, None)
|
||||
.into_diag(dcx, level)
|
||||
IllFormedAttributeInput::new(&suggestions, None, None).into_diag(dcx, level)
|
||||
},
|
||||
span,
|
||||
);
|
||||
|
||||
@@ -173,3 +173,7 @@ pub(crate) struct DocAliasDuplicated {
|
||||
#[label("first defined here")]
|
||||
pub first_definition: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("only `hide` or `show` are allowed in `#[doc(auto_cfg(...))]`")]
|
||||
pub(crate) struct DocAutoCfgExpectsHideOrShow;
|
||||
|
||||
@@ -43,10 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
|
||||
.into_diag(dcx, level)
|
||||
}
|
||||
|
||||
&AttributeLintKind::DocAutoCfgExpectsHideOrShow => {
|
||||
lints::DocAutoCfgExpectsHideOrShow.into_diag(dcx, level)
|
||||
}
|
||||
|
||||
&AttributeLintKind::AmbiguousDeriveHelpers => {
|
||||
lints::AmbiguousDeriveHelpers.into_diag(dcx, level)
|
||||
}
|
||||
|
||||
@@ -3303,10 +3303,6 @@ fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
|
||||
)]
|
||||
pub(crate) struct ExpectedNameValue;
|
||||
|
||||
#[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;
|
||||
|
||||
@@ -656,7 +656,6 @@ pub enum DeprecatedSinceKind {
|
||||
pub enum AttributeLintKind {
|
||||
UnexpectedCfgName((Symbol, Span), Option<(Symbol, Span)>),
|
||||
UnexpectedCfgValue((Symbol, Span), Option<(Symbol, Span)>),
|
||||
DocAutoCfgExpectsHideOrShow,
|
||||
DocAutoCfgHideShowUnexpectedItem { attr_name: Symbol },
|
||||
DocAutoCfgHideShowExpectsList { attr_name: Symbol },
|
||||
DocInvalid,
|
||||
|
||||
Reference in New Issue
Block a user