diff options
| author | xFrednet <xFrednet@gmail.com> | 2022-03-02 18:10:07 +0100 |
|---|---|---|
| committer | xFrednet <xFrednet@gmail.com> | 2022-03-02 18:10:07 +0100 |
| commit | 5275d02433c95c577febf76271c35f7d5f86ed4a (patch) | |
| tree | b251924430b462c70555d074f43f613dae937c24 /compiler/rustc_lint/src | |
| parent | defc056ccc8d0a64048b65915c9d9b29fd5d4ba2 (diff) | |
| download | rust-5275d02433c95c577febf76271c35f7d5f86ed4a.tar.gz rust-5275d02433c95c577febf76271c35f7d5f86ed4a.zip | |
Use Vec for expectations to have a constant order (RFC-2383)
Diffstat (limited to 'compiler/rustc_lint/src')
| -rw-r--r-- | compiler/rustc_lint/src/expect.rs | 4 | ||||
| -rw-r--r-- | compiler/rustc_lint/src/levels.rs | 10 |
2 files changed, 6 insertions, 8 deletions
diff --git a/compiler/rustc_lint/src/expect.rs b/compiler/rustc_lint/src/expect.rs index 7611b41b97e..e6c9d0b0ab0 100644 --- a/compiler/rustc_lint/src/expect.rs +++ b/compiler/rustc_lint/src/expect.rs @@ -1,5 +1,4 @@ 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; @@ -11,8 +10,7 @@ pub fn check_expectations(tcx: TyCtxt<'_>) { } 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) { diff --git a/compiler/rustc_lint/src/levels.rs b/compiler/rustc_lint/src/levels.rs index f40abff7fc0..f46f74fa45f 100644 --- a/compiler/rustc_lint/src/levels.rs +++ b/compiler/rustc_lint/src/levels.rs @@ -45,7 +45,7 @@ fn lint_levels(tcx: TyCtxt<'_>, (): ()) -> LintLevelMap { 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>, @@ -355,7 +355,7 @@ impl<'s> LintLevelsBuilder<'s> { } if let Level::Expect(expect_id) = level { self.lint_expectations - .insert(expect_id, LintExpectation::new(reason, sp)); + .push((expect_id, LintExpectation::new(reason, sp))); } } @@ -374,7 +374,7 @@ impl<'s> LintLevelsBuilder<'s> { } 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)) => { @@ -414,7 +414,7 @@ impl<'s> LintLevelsBuilder<'s> { } 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, _)) => { @@ -511,7 +511,7 @@ impl<'s> LintLevelsBuilder<'s> { } 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); |
