Skip to content

Commit 544df09

Browse files
authored
Unrolled build for #158023
Rollup merge of #158023 - JonathanBrouwer:move-unused-duplicate, r=mejrs Move `UnusedDuplicate` diag struct to `rustc_attr_parsing` This was moved there in #154432, I am not entirely sure why there? This was probably an oversight, at least I missed this during review cc @GuillaumeGomez r? @mejrs
2 parents c1b22f4 + d50d1db commit 544df09

5 files changed

Lines changed: 18 additions & 33 deletions

File tree

compiler/rustc_attr_parsing/src/attributes/doc.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::diagnostics::{
2222
use crate::parser::{ArgParser, MetaItemOrLitParser, MetaItemParser, OwnedPathParser};
2323
use crate::session_diagnostics::{
2424
DocAliasBadChar, DocAliasEmpty, DocAliasMalformed, DocAliasStartEnd, DocAttrNotCrateLevel,
25-
DocAttributeNotAttribute, DocKeywordNotKeyword,
25+
DocAttributeNotAttribute, DocKeywordNotKeyword, UnusedDuplicate,
2626
};
2727

2828
fn check_keyword(cx: &mut AcceptContext<'_, '_>, keyword: Symbol, span: Span) -> bool {
@@ -159,11 +159,7 @@ impl DocParser {
159159
let unused_span = path.span();
160160
cx.emit_lint(
161161
rustc_session::lint::builtin::INVALID_DOC_ATTRIBUTES,
162-
rustc_errors::lints::UnusedDuplicate {
163-
this: unused_span,
164-
other: used_span,
165-
warning: true,
166-
},
162+
UnusedDuplicate { this: unused_span, other: used_span, warning: true },
167163
unused_span,
168164
);
169165
return;

compiler/rustc_attr_parsing/src/context.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ use crate::parser::{
7171
};
7272
use crate::session_diagnostics::{
7373
AttributeParseError, AttributeParseErrorReason, AttributeParseErrorSuggestions,
74-
ParsedDescription,
74+
ParsedDescription, UnusedDuplicate,
7575
};
7676
use crate::target_checking::AllowedTargets;
7777
use crate::{AttrSuggestionStyle, AttributeParser, AttributeTemplate, EmitAttribute};
@@ -436,11 +436,7 @@ impl<'f, 'sess: 'f> SharedContext<'f, 'sess> {
436436
pub(crate) fn warn_unused_duplicate(&mut self, used_span: Span, unused_span: Span) {
437437
self.emit_lint(
438438
rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
439-
rustc_errors::lints::UnusedDuplicate {
440-
this: unused_span,
441-
other: used_span,
442-
warning: false,
443-
},
439+
UnusedDuplicate { this: unused_span, other: used_span, warning: false },
444440
unused_span,
445441
)
446442
}
@@ -452,11 +448,7 @@ impl<'f, 'sess: 'f> SharedContext<'f, 'sess> {
452448
) {
453449
self.emit_lint(
454450
rustc_session::lint::builtin::UNUSED_ATTRIBUTES,
455-
rustc_errors::lints::UnusedDuplicate {
456-
this: unused_span,
457-
other: used_span,
458-
warning: true,
459-
},
451+
UnusedDuplicate { this: unused_span, other: used_span, warning: true },
460452
unused_span,
461453
)
462454
}

compiler/rustc_attr_parsing/src/session_diagnostics.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,3 +1045,16 @@ pub(crate) struct AdditionalCommaSuggestion {
10451045
#[primary_span]
10461046
pub span: Span,
10471047
}
1048+
1049+
#[derive(Diagnostic)]
1050+
#[diag("unused attribute")]
1051+
pub(crate) struct UnusedDuplicate {
1052+
#[suggestion("remove this attribute", code = "", applicability = "machine-applicable")]
1053+
pub this: Span,
1054+
#[note("attribute also specified here")]
1055+
pub other: Span,
1056+
#[warning(
1057+
"this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!"
1058+
)]
1059+
pub warning: bool,
1060+
}

compiler/rustc_errors/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ mod diagnostic_impls;
7979
pub mod emitter;
8080
pub mod formatting;
8181
pub mod json;
82-
pub mod lints;
8382
mod lock;
8483
pub mod markdown;
8584
pub mod timings;

compiler/rustc_errors/src/lints.rs

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)