Remove AttributeLintKind::DocTestLiteral variant

This commit is contained in:
Guillaume Gomez
2026-04-21 12:32:23 +02:00
committed by Jonathan Brouwer
parent b1cc9a60d8
commit 33b896a067
5 changed files with 9 additions and 12 deletions
@@ -15,9 +15,9 @@
use crate::context::{AcceptContext, FinalizeContext, Stage};
use crate::errors::{
DocAliasDuplicated, DocAutoCfgExpectsHideOrShow, DocAutoCfgHideShowExpectsList,
DocAutoCfgHideShowUnexpectedItem, DocAutoCfgWrongLiteral, DocTestTakesList, DocTestUnknown,
DocUnknownAny, DocUnknownInclude, DocUnknownPasses, DocUnknownPlugins, DocUnknownSpotlight,
IllFormedAttributeInput,
DocAutoCfgHideShowUnexpectedItem, DocAutoCfgWrongLiteral, DocTestLiteral, DocTestTakesList,
DocTestUnknown, DocUnknownAny, DocUnknownInclude, DocUnknownPasses, DocUnknownPlugins,
DocUnknownSpotlight, IllFormedAttributeInput,
};
use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser};
use crate::session_diagnostics::{
@@ -224,9 +224,9 @@ fn parse_single_test_doc_attr_item<S: Stage>(
);
}
None => {
cx.emit_lint(
cx.emit_dyn_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
AttributeLintKind::DocTestLiteral,
|dcx, level| DocTestLiteral.into_diag(dcx, level),
path.span(),
);
}
@@ -263,6 +263,10 @@ pub(crate) struct DocTestUnknown {
pub name: Symbol,
}
#[derive(Diagnostic)]
#[diag("`#![doc(test(...)]` does not take a literal")]
pub(crate) struct DocTestLiteral;
#[derive(Diagnostic)]
#[diag("`#[diagnostic::on_const]` can only be applied to non-const trait implementations")]
pub(crate) struct DiagnosticOnConstOnlyForTraitImpls {
@@ -43,8 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
.into_diag(dcx, level)
}
&AttributeLintKind::DocTestLiteral => lints::DocTestLiteral.into_diag(dcx, level),
&AttributeLintKind::AttrCrateLevelOnly => {
lints::AttrCrateLevelOnly.into_diag(dcx, level)
}
-4
View File
@@ -3303,10 +3303,6 @@ fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
)]
pub(crate) struct ExpectedNameValue;
#[derive(Diagnostic)]
#[diag("`#![doc(test(...)]` does not take a literal")]
pub(crate) struct DocTestLiteral;
#[derive(Diagnostic)]
#[diag("this attribute can only be applied at the crate level")]
#[note(
-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)>),
DocTestLiteral,
AttrCrateLevelOnly,
DoNotRecommendDoesNotExpectArgs,
CrateTypeUnknown { span: Span, suggested: Option<Symbol> },