Skip to content

Commit 31561a6

Browse files
committed
Auto merge of rust-lang#133536 - RalfJung:forbidden_lint_groups-error, r=<try>
[crater only] make forbidden_lint_groups a hard error This is to gather information for rust-lang#81670.
2 parents 39cb338 + b20df8f commit 31561a6

File tree

2 files changed

+12
-28
lines changed

2 files changed

+12
-28
lines changed

compiler/rustc_lint/src/levels.rs

+11-15
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ use rustc_middle::query::Providers;
1515
use rustc_middle::ty::{RegisteredTools, TyCtxt};
1616
use rustc_session::Session;
1717
use rustc_session::lint::builtin::{
18-
self, FORBIDDEN_LINT_GROUPS, RENAMED_AND_REMOVED_LINTS, SINGLE_USE_LIFETIMES,
19-
UNFULFILLED_LINT_EXPECTATIONS, UNKNOWN_LINTS, UNUSED_ATTRIBUTES,
18+
self, RENAMED_AND_REMOVED_LINTS, SINGLE_USE_LIFETIMES, UNFULFILLED_LINT_EXPECTATIONS,
19+
UNKNOWN_LINTS, UNUSED_ATTRIBUTES,
2020
};
2121
use rustc_session::lint::{Level, Lint, LintExpectationId, LintId};
2222
use rustc_span::symbol::{Symbol, sym};
@@ -34,9 +34,8 @@ use crate::fluent_generated as fluent;
3434
use crate::late::unerased_lint_store;
3535
use crate::lints::{
3636
DeprecatedLintName, DeprecatedLintNameFromCommandLine, IgnoredUnlessCrateSpecified,
37-
OverruledAttributeLint, RemovedLint, RemovedLintFromCommandLine, RenamedLint,
38-
RenamedLintFromCommandLine, RenamedLintSuggestion, UnknownLint, UnknownLintFromCommandLine,
39-
UnknownLintSuggestion,
37+
RemovedLint, RemovedLintFromCommandLine, RenamedLint, RenamedLintFromCommandLine,
38+
RenamedLintSuggestion, UnknownLint, UnknownLintFromCommandLine, UnknownLintSuggestion,
4039
};
4140

4241
/// Collection of lint levels for the whole crate.
@@ -645,16 +644,13 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
645644
sub,
646645
});
647646
} else {
648-
self.emit_span_lint(
649-
FORBIDDEN_LINT_GROUPS,
650-
src.span().into(),
651-
OverruledAttributeLint {
652-
overruled: src.span(),
653-
lint_level: level.as_str(),
654-
lint_source: src.name(),
655-
sub,
656-
},
657-
);
647+
self.sess.dcx().emit_err(OverruledAttribute {
648+
span: src.span(),
649+
overruled: src.span(),
650+
lint_level: level.as_str(),
651+
lint_source: src.name(),
652+
sub,
653+
});
658654
}
659655

660656
// Retain the forbid lint level, unless we are

compiler/rustc_lint/src/lints.rs

+1-13
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
2020
use rustc_span::{Span, Symbol, sym};
2121

2222
use crate::builtin::{InitError, ShorthandAssocTyCollector, TypeAliasBounds};
23-
use crate::errors::{OverruledAttributeSub, RequestedLevel};
23+
use crate::errors::RequestedLevel;
2424
use crate::{LateContext, fluent_generated as fluent};
2525

2626
// array_into_iter.rs
@@ -1023,18 +1023,6 @@ impl Subdiagnostic for NonBindingLetSub {
10231023
}
10241024
}
10251025

1026-
// levels.rs
1027-
#[derive(LintDiagnostic)]
1028-
#[diag(lint_overruled_attribute)]
1029-
pub(crate) struct OverruledAttributeLint<'a> {
1030-
#[label]
1031-
pub overruled: Span,
1032-
pub lint_level: &'a str,
1033-
pub lint_source: Symbol,
1034-
#[subdiagnostic]
1035-
pub sub: OverruledAttributeSub,
1036-
}
1037-
10381026
#[derive(LintDiagnostic)]
10391027
#[diag(lint_deprecated_lint_name)]
10401028
pub(crate) struct DeprecatedLintName<'a> {

0 commit comments

Comments
 (0)