Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions compiler/rustc_attr_parsing/src/attributes/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::diagnostics::{
use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser};
use crate::session_diagnostics::{
DocAliasBadChar, DocAliasEmpty, DocAliasMalformed, DocAliasStartEnd, DocAttrNotCrateLevel,
DocAttributeNotAttribute, DocKeywordNotKeyword,
DocAttributeNotAttribute, DocKeywordNotKeyword, UnusedDuplicate,
};

fn check_keyword(cx: &mut AcceptContext<'_, '_>, keyword: Symbol, span: Span) -> bool {
Expand Down Expand Up @@ -159,11 +159,7 @@ impl DocParser {
let unused_span = path.span();
cx.emit_lint(
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
rustc_errors::lints::UnusedDuplicate {
this: unused_span,
other: used_span,
warning: true,
},
UnusedDuplicate { this: unused_span, other: used_span, warning: true },
unused_span,
);
return;
Expand Down
14 changes: 3 additions & 11 deletions compiler/rustc_attr_parsing/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ use crate::parser::{
};
use crate::session_diagnostics::{
AttributeParseError, AttributeParseErrorReason, AttributeParseErrorSuggestions,
ParsedDescription,
ParsedDescription, UnusedDuplicate,
};
use crate::target_checking::AllowedTargets;
use crate::{AttrSuggestionStyle, AttributeParser, AttributeTemplate, EmitAttribute};
Expand Down Expand Up @@ -436,11 +436,7 @@ impl<'f, 'sess: 'f> SharedContext<'f, 'sess> {
pub(crate) fn warn_unused_duplicate(&mut self, used_span: Span, unused_span: Span) {
self.emit_lint(
rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
rustc_errors::lints::UnusedDuplicate {
this: unused_span,
other: used_span,
warning: false,
},
UnusedDuplicate { this: unused_span, other: used_span, warning: false },
unused_span,
)
}
Expand All @@ -452,11 +448,7 @@ impl<'f, 'sess: 'f> SharedContext<'f, 'sess> {
) {
self.emit_lint(
rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
rustc_errors::lints::UnusedDuplicate {
this: unused_span,
other: used_span,
warning: true,
},
UnusedDuplicate { this: unused_span, other: used_span, warning: true },
unused_span,
)
}
Expand Down
13 changes: 13 additions & 0 deletions compiler/rustc_attr_parsing/src/session_diagnostics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1045,3 +1045,16 @@ pub(crate) struct AdditionalCommaSuggestion {
#[primary_span]
pub span: Span,
}

#[derive(Diagnostic)]
#[diag("unused attribute")]
pub(crate) struct UnusedDuplicate {
#[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
pub this: Span,
#[note("attribute also specified here")]
pub other: Span,
#[warning(
"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
)]
pub warning: bool,
}
1 change: 0 additions & 1 deletion compiler/rustc_errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ mod diagnostic_impls;
pub mod emitter;
pub mod formatting;
pub mod json;
pub mod lints;
mod lock;
pub mod markdown;
pub mod timings;
Expand Down
15 changes: 0 additions & 15 deletions compiler/rustc_errors/src/lints.rs

This file was deleted.

Loading