use crate::builtin;
-use rustc_data_structures::fx::FxHashMap;
use rustc_hir::HirId;
use rustc_middle::{lint::LintExpectation, ty::TyCtxt};
use rustc_session::lint::LintExpectationId;
}
let fulfilled_expectations = tcx.sess.diagnostic().steal_fulfilled_expectation_ids();
- let lint_expectations: &FxHashMap<LintExpectationId, LintExpectation> =
- &tcx.lint_levels(()).lint_expectations;
+ let lint_expectations = &tcx.lint_levels(()).lint_expectations;
for (id, expectation) in lint_expectations {
if !fulfilled_expectations.contains(id) {
pub struct LintLevelsBuilder<'s> {
sess: &'s Session,
- lint_expectations: FxHashMap<LintExpectationId, LintExpectation>,
+ lint_expectations: Vec<(LintExpectationId, LintExpectation)>,
/// Each expectation has a stable and an unstable identifier. This map
/// is used to map from unstable to stable [`LintExpectationId`]s.
expectation_id_map: FxHashMap<LintExpectationId, LintExpectationId>,
}
if let Level::Expect(expect_id) = level {
self.lint_expectations
- .insert(expect_id, LintExpectation::new(reason, sp));
+ .push((expect_id, LintExpectation::new(reason, sp)));
}
}
}
if let Level::Expect(expect_id) = level {
self.lint_expectations
- .insert(expect_id, LintExpectation::new(reason, sp));
+ .push((expect_id, LintExpectation::new(reason, sp)));
}
}
Err((Some(ids), ref new_lint_name)) => {
}
if let Level::Expect(expect_id) = level {
self.lint_expectations
- .insert(expect_id, LintExpectation::new(reason, sp));
+ .push((expect_id, LintExpectation::new(reason, sp)));
}
}
Err((None, _)) => {
}
if let Level::Expect(expect_id) = level {
self.lint_expectations
- .insert(expect_id, LintExpectation::new(reason, sp));
+ .push((expect_id, LintExpectation::new(reason, sp)));
}
} else {
panic!("renamed lint does not exist: {}", new_name);
///
/// The [`LintExpectationId`] is stored as a part of the [`Expect`](Level::Expect)
/// lint level.
- pub lint_expectations: FxHashMap<LintExpectationId, LintExpectation>,
+ pub lint_expectations: Vec<(LintExpectationId, LintExpectation)>,
pub sets: LintLevelSets,
pub id_to_set: FxHashMap<HirId, LintStackIndex>,
}
= note: `#[warn(unfulfilled_lint_expectations)]` on by default
warning: this lint expectation is unfulfilled
- --> $DIR/expect_multiple_lints.rs:28:10
+ --> $DIR/expect_multiple_lints.rs:10:40
|
LL | #[expect(unused_variables, unused_mut, while_true)]
- | ^^^^^^^^^^^^^^^^
+ | ^^^^^^^^^^
warning: this lint expectation is unfulfilled
--> $DIR/expect_multiple_lints.rs:19:10
| ^^^^^^^^^^^^^^^^
warning: this lint expectation is unfulfilled
- --> $DIR/expect_multiple_lints.rs:28:28
+ --> $DIR/expect_multiple_lints.rs:19:40
|
LL | #[expect(unused_variables, unused_mut, while_true)]
- | ^^^^^^^^^^
+ | ^^^^^^^^^^
warning: this lint expectation is unfulfilled
- --> $DIR/expect_multiple_lints.rs:36:18
+ --> $DIR/expect_multiple_lints.rs:28:10
|
-LL | #[expect(unused, while_true)]
- | ^^^^^^^^^^
+LL | #[expect(unused_variables, unused_mut, while_true)]
+ | ^^^^^^^^^^^^^^^^
warning: this lint expectation is unfulfilled
- --> $DIR/expect_multiple_lints.rs:19:40
+ --> $DIR/expect_multiple_lints.rs:28:28
|
LL | #[expect(unused_variables, unused_mut, while_true)]
- | ^^^^^^^^^^
+ | ^^^^^^^^^^
warning: this lint expectation is unfulfilled
- --> $DIR/expect_multiple_lints.rs:45:10
+ --> $DIR/expect_multiple_lints.rs:36:18
|
LL | #[expect(unused, while_true)]
- | ^^^^^^
+ | ^^^^^^^^^^
warning: this lint expectation is unfulfilled
- --> $DIR/expect_multiple_lints.rs:10:40
+ --> $DIR/expect_multiple_lints.rs:45:10
|
-LL | #[expect(unused_variables, unused_mut, while_true)]
- | ^^^^^^^^^^
+LL | #[expect(unused, while_true)]
+ | ^^^^^^
warning: 8 warnings emitted
#[expect(
unused_mut,
//~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
+ //~| NOTE `#[warn(unfulfilled_lint_expectations)]` on by default
//~| NOTE this `expect` is overridden by a `allow` attribute before the `unused_mut` lint is triggered
reason = "this `expect` is overridden by a `allow` attribute before the `unused_mut` lint is triggered"
)]
#[expect(
unused_mut,
//~^ WARNING this lint expectation is unfulfilled [unfulfilled_lint_expectations]
- //~| NOTE `#[warn(unfulfilled_lint_expectations)]` on by default
//~| NOTE this `expect` is overridden by a `warn` attribute before the `unused_mut` lint is triggered
reason = "this `expect` is overridden by a `warn` attribute before the `unused_mut` lint is triggered"
)]
| ^^^^^^^^^^
warning: this lint expectation is unfulfilled
- --> $DIR/expect_nested_lint_levels.rs:23:5
+ --> $DIR/expect_nested_lint_levels.rs:7:5
|
LL | unused_mut,
| ^^^^^^^^^^
|
= note: `#[warn(unfulfilled_lint_expectations)]` on by default
- = note: this `expect` is overridden by a `warn` attribute before the `unused_mut` lint is triggered
+ = note: this `expect` is overridden by a `allow` attribute before the `unused_mut` lint is triggered
warning: this lint expectation is unfulfilled
- --> $DIR/expect_nested_lint_levels.rs:7:5
+ --> $DIR/expect_nested_lint_levels.rs:24:5
|
LL | unused_mut,
| ^^^^^^^^^^
|
- = note: this `expect` is overridden by a `allow` attribute before the `unused_mut` lint is triggered
+ = note: this `expect` is overridden by a `warn` attribute before the `unused_mut` lint is triggered
warning: this lint expectation is unfulfilled
--> $DIR/expect_nested_lint_levels.rs:43:10