@@ -15,7 +15,7 @@ use crate::{
15
15
} ;
16
16
use rustc_ast as ast;
17
17
use rustc_ast_pretty:: pprust;
18
- use rustc_data_structures:: fx:: FxHashMap ;
18
+ use rustc_data_structures:: fx:: FxIndexMap ;
19
19
use rustc_errors:: { DecorateLint , DiagnosticBuilder , DiagnosticMessage , MultiSpan } ;
20
20
use rustc_feature:: { Features , GateIssue } ;
21
21
use rustc_hir as hir;
@@ -73,7 +73,7 @@ rustc_index::newtype_index! {
73
73
struct LintSet {
74
74
// -A,-W,-D flags, a `Symbol` for the flag itself and `Level` for which
75
75
// flag.
76
- specs : FxHashMap < LintId , LevelAndSource > ,
76
+ specs : FxIndexMap < LintId , LevelAndSource > ,
77
77
parent : LintStackIndex ,
78
78
}
79
79
@@ -86,7 +86,7 @@ impl LintLevelSets {
86
86
& self ,
87
87
lint : & ' static Lint ,
88
88
idx : LintStackIndex ,
89
- aux : Option < & FxHashMap < LintId , LevelAndSource > > ,
89
+ aux : Option < & FxIndexMap < LintId , LevelAndSource > > ,
90
90
sess : & Session ,
91
91
) -> LevelAndSource {
92
92
let lint = LintId :: of ( lint) ;
@@ -101,7 +101,7 @@ impl LintLevelSets {
101
101
& self ,
102
102
id : LintId ,
103
103
mut idx : LintStackIndex ,
104
- aux : Option < & FxHashMap < LintId , LevelAndSource > > ,
104
+ aux : Option < & FxIndexMap < LintId , LevelAndSource > > ,
105
105
) -> ( Option < Level > , LintLevelSource ) {
106
106
if let Some ( specs) = aux {
107
107
if let Some ( & ( level, src) ) = specs. get ( & id) {
@@ -132,8 +132,8 @@ fn lint_expectations(tcx: TyCtxt<'_>, (): ()) -> Vec<(LintExpectationId, LintExp
132
132
cur : hir:: CRATE_HIR_ID ,
133
133
specs : ShallowLintLevelMap :: default ( ) ,
134
134
expectations : Vec :: new ( ) ,
135
- unstable_to_stable_ids : FxHashMap :: default ( ) ,
136
- empty : FxHashMap :: default ( ) ,
135
+ unstable_to_stable_ids : FxIndexMap :: default ( ) ,
136
+ empty : FxIndexMap :: default ( ) ,
137
137
} ,
138
138
lint_added_lints : false ,
139
139
store,
@@ -161,7 +161,7 @@ fn shallow_lint_levels_on(tcx: TyCtxt<'_>, owner: hir::OwnerId) -> ShallowLintLe
161
161
tcx,
162
162
cur : owner. into ( ) ,
163
163
specs : ShallowLintLevelMap :: default ( ) ,
164
- empty : FxHashMap :: default ( ) ,
164
+ empty : FxIndexMap :: default ( ) ,
165
165
attrs,
166
166
} ,
167
167
lint_added_lints : false ,
@@ -209,14 +209,14 @@ pub struct TopDown {
209
209
}
210
210
211
211
pub trait LintLevelsProvider {
212
- fn current_specs ( & self ) -> & FxHashMap < LintId , LevelAndSource > ;
212
+ fn current_specs ( & self ) -> & FxIndexMap < LintId , LevelAndSource > ;
213
213
fn insert ( & mut self , id : LintId , lvl : LevelAndSource ) ;
214
214
fn get_lint_level ( & self , lint : & ' static Lint , sess : & Session ) -> LevelAndSource ;
215
215
fn push_expectation ( & mut self , _id : LintExpectationId , _expectation : LintExpectation ) { }
216
216
}
217
217
218
218
impl LintLevelsProvider for TopDown {
219
- fn current_specs ( & self ) -> & FxHashMap < LintId , LevelAndSource > {
219
+ fn current_specs ( & self ) -> & FxIndexMap < LintId , LevelAndSource > {
220
220
& self . sets . list [ self . cur ] . specs
221
221
}
222
222
@@ -234,12 +234,12 @@ struct LintLevelQueryMap<'tcx> {
234
234
cur : HirId ,
235
235
specs : ShallowLintLevelMap ,
236
236
/// Empty hash map to simplify code.
237
- empty : FxHashMap < LintId , LevelAndSource > ,
237
+ empty : FxIndexMap < LintId , LevelAndSource > ,
238
238
attrs : & ' tcx hir:: AttributeMap < ' tcx > ,
239
239
}
240
240
241
241
impl LintLevelsProvider for LintLevelQueryMap < ' _ > {
242
- fn current_specs ( & self ) -> & FxHashMap < LintId , LevelAndSource > {
242
+ fn current_specs ( & self ) -> & FxIndexMap < LintId , LevelAndSource > {
243
243
self . specs . specs . get ( & self . cur . local_id ) . unwrap_or ( & self . empty )
244
244
}
245
245
fn insert ( & mut self , id : LintId , lvl : LevelAndSource ) {
@@ -257,13 +257,13 @@ struct QueryMapExpectationsWrapper<'tcx> {
257
257
/// Level map for `cur`.
258
258
specs : ShallowLintLevelMap ,
259
259
expectations : Vec < ( LintExpectationId , LintExpectation ) > ,
260
- unstable_to_stable_ids : FxHashMap < LintExpectationId , LintExpectationId > ,
260
+ unstable_to_stable_ids : FxIndexMap < LintExpectationId , LintExpectationId > ,
261
261
/// Empty hash map to simplify code.
262
- empty : FxHashMap < LintId , LevelAndSource > ,
262
+ empty : FxIndexMap < LintId , LevelAndSource > ,
263
263
}
264
264
265
265
impl LintLevelsProvider for QueryMapExpectationsWrapper < ' _ > {
266
- fn current_specs ( & self ) -> & FxHashMap < LintId , LevelAndSource > {
266
+ fn current_specs ( & self ) -> & FxIndexMap < LintId , LevelAndSource > {
267
267
self . specs . specs . get ( & self . cur . local_id ) . unwrap_or ( & self . empty )
268
268
}
269
269
fn insert ( & mut self , id : LintId , lvl : LevelAndSource ) {
@@ -486,7 +486,7 @@ impl<'s> LintLevelsBuilder<'s, TopDown> {
486
486
. provider
487
487
. sets
488
488
. list
489
- . push ( LintSet { specs : FxHashMap :: default ( ) , parent : COMMAND_LINE } ) ;
489
+ . push ( LintSet { specs : FxIndexMap :: default ( ) , parent : COMMAND_LINE } ) ;
490
490
self . add_command_line ( ) ;
491
491
}
492
492
@@ -512,7 +512,7 @@ impl<'s> LintLevelsBuilder<'s, TopDown> {
512
512
) -> BuilderPush {
513
513
let prev = self . provider . cur ;
514
514
self . provider . cur =
515
- self . provider . sets . list . push ( LintSet { specs : FxHashMap :: default ( ) , parent : prev } ) ;
515
+ self . provider . sets . list . push ( LintSet { specs : FxIndexMap :: default ( ) , parent : prev } ) ;
516
516
517
517
self . add ( attrs, is_crate_node, source_hir_id) ;
518
518
@@ -547,7 +547,7 @@ impl<'s, P: LintLevelsProvider> LintLevelsBuilder<'s, P> {
547
547
self . features
548
548
}
549
549
550
- fn current_specs ( & self ) -> & FxHashMap < LintId , LevelAndSource > {
550
+ fn current_specs ( & self ) -> & FxIndexMap < LintId , LevelAndSource > {
551
551
self . provider . current_specs ( )
552
552
}
553
553
0 commit comments