1
Fork 0

Use Vec for expectations to have a constant order (RFC-2383)

This commit is contained in:
xFrednet 2022-03-02 18:10:07 +01:00
parent defc056ccc
commit 5275d02433
No known key found for this signature in database
GPG key ID: FCDCBF29AF64D601
6 changed files with 31 additions and 33 deletions

View file

@ -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);