Skip to content

Commit 0899c7c

Browse files
committed
Compute lint_levels by definition
1 parent 86c6ebe commit 0899c7c

File tree

13 files changed

+483
-327
lines changed

13 files changed

+483
-327
lines changed

compiler/rustc_errors/src/diagnostic.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,10 @@ impl Diagnostic {
311311
// The lint index inside the attribute is manually transferred here.
312312
let lint_index = expectation_id.get_lint_index();
313313
expectation_id.set_lint_index(None);
314-
let mut stable_id = *unstable_to_stable
314+
let mut stable_id = unstable_to_stable
315315
.get(&expectation_id)
316-
.expect("each unstable `LintExpectationId` must have a matching stable id");
316+
.expect("each unstable `LintExpectationId` must have a matching stable id")
317+
.normalize();
317318

318319
stable_id.set_lint_index(lint_index);
319320
*expectation_id = stable_id;

compiler/rustc_errors/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1145,7 +1145,7 @@ impl HandlerInner {
11451145

11461146
if let Some(expectation_id) = diagnostic.level.get_expectation_id() {
11471147
self.suppressed_expected_diag = true;
1148-
self.fulfilled_expectations.insert(expectation_id);
1148+
self.fulfilled_expectations.insert(expectation_id.normalize());
11491149
}
11501150

11511151
if matches!(diagnostic.level, Warning(_))

compiler/rustc_lint/src/context.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ pub struct LateContext<'tcx> {
574574

575575
/// Context for lint checking of the AST, after expansion, before lowering to HIR.
576576
pub struct EarlyContext<'a> {
577-
pub builder: LintLevelsBuilder<'a>,
577+
pub builder: LintLevelsBuilder<'a, crate::levels::TopDown>,
578578
pub buffered: LintBuffer,
579579
}
580580

compiler/rustc_lint/src/early.rs

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ impl<'a, T: EarlyLintPass> EarlyContextAndPass<'a, T> {
6060
F: FnOnce(&mut Self),
6161
{
6262
let is_crate_node = id == ast::CRATE_NODE_ID;
63+
debug!(?id);
6364
let push = self.context.builder.push(attrs, is_crate_node, None);
6465

6566
self.check_id(id);

compiler/rustc_lint/src/expect.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ fn check_expectations(tcx: TyCtxt<'_>, tool_filter: Option<Symbol>) {
1616
return;
1717
}
1818

19+
let lint_expectations = tcx.lint_expectations(());
1920
let fulfilled_expectations = tcx.sess.diagnostic().steal_fulfilled_expectation_ids();
20-
let lint_expectations = &tcx.lint_levels(()).lint_expectations;
21+
22+
tracing::debug!(?lint_expectations, ?fulfilled_expectations);
2123

2224
for (id, expectation) in lint_expectations {
2325
// This check will always be true, since `lint_expectations` only

0 commit comments

Comments
 (0)