@@ -2,7 +2,7 @@ use std::cell::LazyCell;
22use std:: ops:: { ControlFlow , Deref } ;
33
44use hir:: intravisit:: { self , Visitor } ;
5- use rustc_data_structures:: fx:: { FxHashMap , FxHashSet , FxIndexSet } ;
5+ use rustc_data_structures:: fx:: { FxHashSet , FxIndexMap , FxIndexSet } ;
66use rustc_errors:: codes:: * ;
77use rustc_errors:: { Applicability , ErrorGuaranteed , pluralize, struct_span_code_err} ;
88use rustc_hir:: ItemKind ;
@@ -404,7 +404,7 @@ fn check_trait_item<'tcx>(
404404/// ```
405405fn check_gat_where_clauses ( tcx : TyCtxt < ' _ > , trait_def_id : LocalDefId ) {
406406// 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 ( ) ;
408408let associated_items = tcx. associated_items ( trait_def_id) ;
409409
410410// 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) {
430430// Gather the bounds with which all other items inside of this trait constrain the GAT.
431431// This is calculated by taking the intersection of the bounds that each item
432432// 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 ;
434434for item in associated_items. in_definition_order ( ) {
435435let item_def_id = item. def_id . expect_local ( ) ;
436436// 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) {
589589fn augment_param_env < ' tcx > (
590590tcx : TyCtxt < ' tcx > ,
591591param_env : ty:: ParamEnv < ' tcx > ,
592- new_predicates : Option < & FxHashSet < ty:: Clause < ' tcx > > > ,
592+ new_predicates : Option < & FxIndexSet < ty:: Clause < ' tcx > > > ,
593593) -> ty:: ParamEnv < ' tcx > {
594594let Some ( new_predicates) = new_predicates else {
595595return param_env;
@@ -625,9 +625,9 @@ fn gather_gat_bounds<'tcx, T: TypeFoldable<TyCtxt<'tcx>>>(
625625wf_tys : & FxIndexSet < Ty < ' tcx > > ,
626626gat_def_id : LocalDefId ,
627627gat_generics : & ' tcx ty:: Generics ,
628- ) -> Option < FxHashSet < ty:: Clause < ' tcx > > > {
628+ ) -> Option < FxIndexSet < ty:: Clause < ' tcx > > > {
629629// The bounds we that we would require from `to_check`
630- let mut bounds = FxHashSet :: default ( ) ;
630+ let mut bounds = FxIndexSet :: default ( ) ;
631631
632632let ( regions, types) = GATArgsCollector :: visit ( gat_def_id. to_def_id ( ) , to_check) ;
633633
@@ -789,18 +789,18 @@ fn test_region_obligations<'tcx>(
789789struct GATArgsCollector < ' tcx > {
790790gat : DefId ,
791791// Which region appears and which parameter index its instantiated with
792- regions : FxHashSet < ( ty:: Region < ' tcx > , usize ) > ,
792+ regions : FxIndexSet < ( ty:: Region < ' tcx > , usize ) > ,
793793// Which params appears and which parameter index its instantiated with
794- types : FxHashSet < ( Ty < ' tcx > , usize ) > ,
794+ types : FxIndexSet < ( Ty < ' tcx > , usize ) > ,
795795}
796796
797797impl < ' tcx > GATArgsCollector < ' tcx > {
798798fn visit < T : TypeFoldable < TyCtxt < ' tcx > > > (
799799gat : DefId ,
800800t : T ,
801- ) -> ( FxHashSet < ( ty:: Region < ' tcx > , usize ) > , FxHashSet < ( Ty < ' tcx > , usize ) > ) {
801+ ) -> ( FxIndexSet < ( ty:: Region < ' tcx > , usize ) > , FxIndexSet < ( Ty < ' tcx > , usize ) > ) {
802802let mut visitor =
803- GATArgsCollector { gat, regions : FxHashSet :: default ( ) , types : FxHashSet :: default ( ) } ;
803+ GATArgsCollector { gat, regions : FxIndexSet :: default ( ) , types : FxIndexSet :: default ( ) } ;
804804 t. visit_with ( & mut visitor) ;
805805( visitor. regions , visitor. types )
806806}
0 commit comments