mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-26 13:01:27 +03:00
Remove AttributeLintKind::IgnoredDiagnosticOption variant
This commit is contained in:
@@ -19,8 +19,8 @@
|
||||
|
||||
use crate::context::{AcceptContext, Stage};
|
||||
use crate::errors::{
|
||||
DisallowedPlaceholder, DisallowedPositionalArgument, InvalidFormatSpecifier,
|
||||
MalFormedDiagnosticAttributeLint, WrappedParserError,
|
||||
DisallowedPlaceholder, DisallowedPositionalArgument, IgnoredDiagnosticOption,
|
||||
InvalidFormatSpecifier, MalFormedDiagnosticAttributeLint, WrappedParserError,
|
||||
};
|
||||
use crate::parser::{ArgParser, MetaItemListParser, MetaItemOrLitParser, MetaItemParser};
|
||||
|
||||
@@ -116,12 +116,12 @@ fn merge<T, S: Stage>(
|
||||
match (first, later) {
|
||||
(Some(_) | None, None) => {}
|
||||
(Some((first_span, _)), Some((later_span, _))) => {
|
||||
cx.emit_lint(
|
||||
let first_span = *first_span;
|
||||
cx.emit_dyn_lint(
|
||||
MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
AttributeLintKind::IgnoredDiagnosticOption {
|
||||
first_span: *first_span,
|
||||
later_span,
|
||||
option_name,
|
||||
move |dcx, level| {
|
||||
IgnoredDiagnosticOption { first_span, later_span, option_name }
|
||||
.into_diag(dcx, level)
|
||||
},
|
||||
later_span,
|
||||
);
|
||||
@@ -220,13 +220,14 @@ fn parse_directive_items<'p, S: Stage>(
|
||||
}}
|
||||
|
||||
macro duplicate($name: ident, $($first_span:tt)*) {{
|
||||
cx.emit_lint(
|
||||
let first_span = $($first_span)*;
|
||||
cx.emit_dyn_lint(
|
||||
MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
AttributeLintKind::IgnoredDiagnosticOption {
|
||||
first_span: $($first_span)*,
|
||||
move |dcx, level| IgnoredDiagnosticOption {
|
||||
first_span,
|
||||
later_span: span,
|
||||
option_name: $name,
|
||||
},
|
||||
}.into_diag(dcx, level),
|
||||
span,
|
||||
);
|
||||
}}
|
||||
|
||||
@@ -382,3 +382,13 @@ pub(crate) struct WrappedParserError<'a> {
|
||||
pub span: Span,
|
||||
pub label: &'a str,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("`{$option_name}` is ignored due to previous definition of `{$option_name}`")]
|
||||
pub(crate) struct IgnoredDiagnosticOption {
|
||||
pub option_name: Symbol,
|
||||
#[label("`{$option_name}` is first declared here")]
|
||||
pub first_span: Span,
|
||||
#[label("`{$option_name}` is later redundantly declared here")]
|
||||
pub later_span: Span,
|
||||
}
|
||||
|
||||
@@ -43,10 +43,6 @@ fn into_diag(self, dcx: DiagCtxtHandle<'a>, level: Level) -> Diag<'a, ()> {
|
||||
.into_diag(dcx, level)
|
||||
}
|
||||
|
||||
&AttributeLintKind::IgnoredDiagnosticOption { option_name, first_span, later_span } => {
|
||||
lints::IgnoredDiagnosticOption { option_name, first_span, later_span }
|
||||
.into_diag(dcx, level)
|
||||
}
|
||||
&AttributeLintKind::MissingOptionsForDiagnosticAttribute { attribute, options } => {
|
||||
lints::MissingOptionsForDiagnosticAttribute { attribute, options }
|
||||
.into_diag(dcx, level)
|
||||
|
||||
@@ -3282,16 +3282,6 @@ fn add_to_diag<G: EmissionGuarantee>(self, diag: &mut Diag<'_, G>) {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("`{$option_name}` is ignored due to previous definition of `{$option_name}`")]
|
||||
pub(crate) struct IgnoredDiagnosticOption {
|
||||
pub option_name: Symbol,
|
||||
#[label("`{$option_name}` is first declared here")]
|
||||
pub first_span: Span,
|
||||
#[label("`{$option_name}` is later redundantly declared here")]
|
||||
pub later_span: Span,
|
||||
}
|
||||
|
||||
#[derive(Diagnostic)]
|
||||
#[diag("missing options for `{$attribute}` attribute")]
|
||||
#[help("{$options}")]
|
||||
|
||||
@@ -656,7 +656,6 @@ pub enum DeprecatedSinceKind {
|
||||
pub enum AttributeLintKind {
|
||||
UnexpectedCfgName((Symbol, Span), Option<(Symbol, Span)>),
|
||||
UnexpectedCfgValue((Symbol, Span), Option<(Symbol, Span)>),
|
||||
IgnoredDiagnosticOption { option_name: Symbol, first_span: Span, later_span: Span },
|
||||
MissingOptionsForDiagnosticAttribute { attribute: &'static str, options: &'static str },
|
||||
NonMetaItemDiagnosticAttribute,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user