Skip to content

Commit

Permalink
Auto merge of rust-lang#133536 - RalfJung:forbidden_lint_groups-error…
Browse files Browse the repository at this point in the history
…, r=<try>

[crater only] make forbidden_lint_groups a hard error

This is to gather information for rust-lang#81670.
  • Loading branch information
bors committed Nov 27, 2024
2 parents 39cb338 + b20df8f commit 31561a6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 28 deletions.
26 changes: 11 additions & 15 deletions compiler/rustc_lint/src/levels.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ use rustc_middle::query::Providers;
use rustc_middle::ty::{RegisteredTools, TyCtxt};
use rustc_session::Session;
use rustc_session::lint::builtin::{
self, FORBIDDEN_LINT_GROUPS, RENAMED_AND_REMOVED_LINTS, SINGLE_USE_LIFETIMES,
UNFULFILLED_LINT_EXPECTATIONS, UNKNOWN_LINTS, UNUSED_ATTRIBUTES,
self, RENAMED_AND_REMOVED_LINTS, SINGLE_USE_LIFETIMES, UNFULFILLED_LINT_EXPECTATIONS,
UNKNOWN_LINTS, UNUSED_ATTRIBUTES,
};
use rustc_session::lint::{Level, Lint, LintExpectationId, LintId};
use rustc_span::symbol::{Symbol, sym};
Expand All @@ -34,9 +34,8 @@ use crate::fluent_generated as fluent;
use crate::late::unerased_lint_store;
use crate::lints::{
DeprecatedLintName, DeprecatedLintNameFromCommandLine, IgnoredUnlessCrateSpecified,
OverruledAttributeLint, RemovedLint, RemovedLintFromCommandLine, RenamedLint,
RenamedLintFromCommandLine, RenamedLintSuggestion, UnknownLint, UnknownLintFromCommandLine,
UnknownLintSuggestion,
RemovedLint, RemovedLintFromCommandLine, RenamedLint, RenamedLintFromCommandLine,
RenamedLintSuggestion, UnknownLint, UnknownLintFromCommandLine, UnknownLintSuggestion,
};

/// Collection of lint levels for the whole crate.
Expand Down Expand Up @@ -645,16 +644,13 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
sub,
});
} else {
self.emit_span_lint(
FORBIDDEN_LINT_GROUPS,
src.span().into(),
OverruledAttributeLint {
overruled: src.span(),
lint_level: level.as_str(),
lint_source: src.name(),
sub,
},
);
self.sess.dcx().emit_err(OverruledAttribute {
span: src.span(),
overruled: src.span(),
lint_level: level.as_str(),
lint_source: src.name(),
sub,
});
}

// Retain the forbid lint level, unless we are
Expand Down
14 changes: 1 addition & 13 deletions compiler/rustc_lint/src/lints.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use rustc_span::symbol::{Ident, MacroRulesNormalizedIdent};
use rustc_span::{Span, Symbol, sym};

use crate::builtin::{InitError, ShorthandAssocTyCollector, TypeAliasBounds};
use crate::errors::{OverruledAttributeSub, RequestedLevel};
use crate::errors::RequestedLevel;
use crate::{LateContext, fluent_generated as fluent};

// array_into_iter.rs
Expand Down Expand Up @@ -1023,18 +1023,6 @@ impl Subdiagnostic for NonBindingLetSub {
}
}

// levels.rs
#[derive(LintDiagnostic)]
#[diag(lint_overruled_attribute)]
pub(crate) struct OverruledAttributeLint<'a> {
#[label]
pub overruled: Span,
pub lint_level: &'a str,
pub lint_source: Symbol,
#[subdiagnostic]
pub sub: OverruledAttributeSub,
}

#[derive(LintDiagnostic)]
#[diag(lint_deprecated_lint_name)]
pub(crate) struct DeprecatedLintName<'a> {
Expand Down

0 comments on commit 31561a6

Please sign in to comment.