Skip to content

Commit 7a07b79

Browse files
Remove AttributeLintKind::NonMetaItemDiagnosticAttribute variant
1 parent 87b0ce5 commit 7a07b79

5 files changed

Lines changed: 11 additions & 18 deletions

File tree

compiler/rustc_attr_parsing/src/attributes/diagnostic/mod.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use rustc_hir::attrs::diagnostic::{
66
Directive, FilterFormatString, Flag, FormatArg, FormatString, LitOrArg, Name, NameValue,
77
OnUnimplementedCondition, Piece, Predicate,
88
};
9-
use rustc_hir::lints::{AttributeLintKind, FormatWarning};
9+
use rustc_hir::lints::FormatWarning;
1010
use rustc_macros::Diagnostic;
1111
use rustc_parse_format::{
1212
Argument, FormatSpec, ParseError, ParseMode, Parser, Piece as RpfPiece, Position,
@@ -21,7 +21,7 @@ use crate::context::{AcceptContext, Stage};
2121
use crate::errors::{
2222
DisallowedPlaceholder, DisallowedPositionalArgument, IgnoredDiagnosticOption,
2323
InvalidFormatSpecifier, MalFormedDiagnosticAttributeLint, MissingOptionsForDiagnosticAttribute,
24-
WrappedParserError,
24+
NonMetaItemDiagnosticAttribute, WrappedParserError,
2525
};
2626
use crate::parser::{ArgParser, MetaItemListParser, MetaItemOrLitParser, MetaItemParser};
2727

@@ -145,9 +145,9 @@ fn parse_list<'p, S: Stage>(
145145
// We're dealing with `#[diagnostic::attr()]`.
146146
// This can be because that is what the user typed, but that's also what we'd see
147147
// if the user used non-metaitem syntax. See `ArgParser::from_attr_args`.
148-
cx.emit_lint(
148+
cx.emit_dyn_lint(
149149
MALFORMED_DIAGNOSTIC_ATTRIBUTES,
150-
AttributeLintKind::NonMetaItemDiagnosticAttribute,
150+
move |dcx, level| NonMetaItemDiagnosticAttribute.into_diag(dcx, level),
151151
list.span,
152152
);
153153
}

compiler/rustc_attr_parsing/src/errors.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -400,3 +400,10 @@ pub(crate) struct MissingOptionsForDiagnosticAttribute {
400400
pub attribute: &'static str,
401401
pub options: &'static str,
402402
}
403+
404+
#[derive(Diagnostic)]
405+
#[diag("expected a literal or missing delimiter")]
406+
#[help(
407+
"only literals are allowed as values for the `message`, `note` and `label` options. These options must be separated by a comma"
408+
)]
409+
pub(crate) struct NonMetaItemDiagnosticAttribute;

compiler/rustc_lint/src/early/diagnostics.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ use rustc_hir::lints::AttributeLintKind;
66
use rustc_middle::ty::TyCtxt;
77
use rustc_session::Session;
88

9-
use crate::lints;
10-
119
mod check_cfg;
1210

1311
pub struct DiagAndSess<'sess> {
@@ -42,10 +40,6 @@ impl<'a> Diagnostic<'a, ()> for DecorateAttrLint<'_, '_, '_> {
4240
check_cfg::unexpected_cfg_value(self.sess, self.tcx, name, value)
4341
.into_diag(dcx, level)
4442
}
45-
46-
&AttributeLintKind::NonMetaItemDiagnosticAttribute => {
47-
lints::NonMetaItemDiagnosticAttribute.into_diag(dcx, level)
48-
}
4943
}
5044
}
5145
}

compiler/rustc_lint/src/lints.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3286,10 +3286,3 @@ impl Subdiagnostic for MismatchedLifetimeSyntaxesSuggestion {
32863286
#[diag("`Eq::assert_receiver_is_total_eq` should never be implemented by hand")]
32873287
#[note("this method was used to add checks to the `Eq` derive macro")]
32883288
pub(crate) struct EqInternalMethodImplemented;
3289-
3290-
#[derive(Diagnostic)]
3291-
#[diag("expected a literal or missing delimiter")]
3292-
#[help(
3293-
"only literals are allowed as values for the `message`, `note` and `label` options. These options must be separated by a comma"
3294-
)]
3295-
pub(crate) struct NonMetaItemDiagnosticAttribute;

compiler/rustc_lint_defs/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,6 @@ pub enum DeprecatedSinceKind {
656656
pub enum AttributeLintKind {
657657
UnexpectedCfgName((Symbol, Span), Option<(Symbol, Span)>),
658658
UnexpectedCfgValue((Symbol, Span), Option<(Symbol, Span)>),
659-
NonMetaItemDiagnosticAttribute,
660659
}
661660

662661
#[derive(Debug, Clone, HashStable_Generic)]

0 commit comments

Comments
 (0)