@@ -2,7 +2,7 @@ use std::cell::LazyCell;
2
2
use std:: ops:: { ControlFlow , Deref } ;
3
3
4
4
use hir:: intravisit:: { self , Visitor } ;
5
- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexSet } ;
5
+ use rustc_data_structures:: fx:: { FxHashSet , FxIndexMap , FxIndexSet } ;
6
6
use rustc_errors:: codes:: * ;
7
7
use rustc_errors:: { Applicability , ErrorGuaranteed , pluralize, struct_span_code_err} ;
8
8
use rustc_hir:: ItemKind ;
@@ -404,7 +404,7 @@ fn check_trait_item<'tcx>(
404
404
/// ```
405
405
fn check_gat_where_clauses ( tcx : TyCtxt < ' _ > , trait_def_id : LocalDefId ) {
406
406
// Associates every GAT's def_id to a list of possibly missing bounds detected by this lint.
407
- let mut required_bounds_by_item = FxHashMap :: default ( ) ;
407
+ let mut required_bounds_by_item = FxIndexMap :: default ( ) ;
408
408
let associated_items = tcx. associated_items ( trait_def_id) ;
409
409
410
410
// Loop over all GATs together, because if this lint suggests adding a where-clause bound
@@ -430,7 +430,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) {
430
430
// Gather the bounds with which all other items inside of this trait constrain the GAT.
431
431
// This is calculated by taking the intersection of the bounds that each item
432
432
// constrains the GAT with individually.
433
- let mut new_required_bounds: Option < FxHashSet < ty:: Clause < ' _ > > > = None ;
433
+ let mut new_required_bounds: Option < FxIndexSet < ty:: Clause < ' _ > > > = None ;
434
434
for item in associated_items. in_definition_order ( ) {
435
435
let item_def_id = item. def_id . expect_local ( ) ;
436
436
// Skip our own GAT, since it does not constrain itself at all.
@@ -589,7 +589,7 @@ fn check_gat_where_clauses(tcx: TyCtxt<'_>, trait_def_id: LocalDefId) {
589
589
fn augment_param_env < ' tcx > (
590
590
tcx : TyCtxt < ' tcx > ,
591
591
param_env : ty:: ParamEnv < ' tcx > ,
592
- new_predicates : Option < & FxHashSet < ty:: Clause < ' tcx > > > ,
592
+ new_predicates : Option < & FxIndexSet < ty:: Clause < ' tcx > > > ,
593
593
) -> ty:: ParamEnv < ' tcx > {
594
594
let Some ( new_predicates) = new_predicates else {
595
595
return param_env;
@@ -625,9 +625,9 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
625
625
wf_tys : & FxIndexSet < Ty < ' tcx > > ,
626
626
gat_def_id : LocalDefId ,
627
627
gat_generics : & ' tcx ty:: Generics ,
628
- ) -> Option < FxHashSet < ty:: Clause < ' tcx > > > {
628
+ ) -> Option < FxIndexSet < ty:: Clause < ' tcx > > > {
629
629
// The bounds we that we would require from `to_check`
630
- let mut bounds = FxHashSet :: default ( ) ;
630
+ let mut bounds = FxIndexSet :: default ( ) ;
631
631
632
632
let ( regions, types) = GATArgsCollector :: visit ( gat_def_id. to_def_id ( ) , to_check) ;
633
633
@@ -789,18 +789,18 @@ fn test_region_obligations<'tcx>(
789
789
struct GATArgsCollector < ' tcx > {
790
790
gat : DefId ,
791
791
// Which region appears and which parameter index its instantiated with
792
- regions : FxHashSet < ( ty:: Region < ' tcx > , usize ) > ,
792
+ regions : FxIndexSet < ( ty:: Region < ' tcx > , usize ) > ,
793
793
// Which params appears and which parameter index its instantiated with
794
- types : FxHashSet < ( Ty < ' tcx > , usize ) > ,
794
+ types : FxIndexSet < ( Ty < ' tcx > , usize ) > ,
795
795
}
796
796
797
797
impl < ' tcx > GATArgsCollector < ' tcx > {
798
798
fn visit < T : TypeFoldable < TyCtxt < ' tcx > > > (
799
799
gat : DefId ,
800
800
t : T ,
801
- ) -> ( FxHashSet < ( ty:: Region < ' tcx > , usize ) > , FxHashSet < ( Ty < ' tcx > , usize ) > ) {
801
+ ) -> ( FxIndexSet < ( ty:: Region < ' tcx > , usize ) > , FxIndexSet < ( Ty < ' tcx > , usize ) > ) {
802
802
let mut visitor =
803
- GATArgsCollector { gat, regions : FxHashSet :: default ( ) , types : FxHashSet :: default ( ) } ;
803
+ GATArgsCollector { gat, regions : FxIndexSet :: default ( ) , types : FxIndexSet :: default ( ) } ;
804
804
t. visit_with ( & mut visitor) ;
805
805
( visitor. regions , visitor. types )
806
806
}
0 commit comments