@@ -272,7 +272,7 @@ impl RibKind<'_> {
272272/// resolving, the name is looked up from inside out.
273273#[ derive( Debug ) ]
274274pub ( crate ) struct Rib < ' ra , R = Res > {
275- pub bindings : FxHashMap < Ident , R > ,
275+ pub bindings : FxIndexMap < Ident , R > ,
276276 pub patterns_with_skipped_bindings : UnordMap < DefId , Vec < ( Span , Result < ( ) , ErrorGuaranteed > ) > > ,
277277 pub kind : RibKind < ' ra > ,
278278}
@@ -1639,8 +1639,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
16391639
16401640 // Allow all following defaults to refer to this type parameter.
16411641 let i = & Ident :: with_dummy_span ( param. ident . name ) ;
1642- forward_ty_ban_rib. bindings . remove ( i) ;
1643- forward_ty_ban_rib_const_param_ty. bindings . remove ( i) ;
1642+ forward_ty_ban_rib. bindings . swap_remove ( i) ;
1643+ forward_ty_ban_rib_const_param_ty. bindings . swap_remove ( i) ;
16441644 }
16451645 GenericParamKind :: Const { ref ty, kw_span : _, ref default } => {
16461646 // Const parameters can't have param bounds.
@@ -1675,8 +1675,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
16751675
16761676 // Allow all following defaults to refer to this const parameter.
16771677 let i = & Ident :: with_dummy_span ( param. ident . name ) ;
1678- forward_const_ban_rib. bindings . remove ( i) ;
1679- forward_const_ban_rib_const_param_ty. bindings . remove ( i) ;
1678+ forward_const_ban_rib. bindings . swap_remove ( i) ;
1679+ forward_const_ban_rib_const_param_ty. bindings . swap_remove ( i) ;
16801680 }
16811681 }
16821682 }
@@ -2885,7 +2885,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
28852885 break ;
28862886 }
28872887
2888- #[ allow( rustc:: potential_query_instability) ] // FIXME
28892888 seen_bindings
28902889 . extend ( parent_rib. bindings . keys ( ) . map ( |ident| ( * ident, ident. span ) ) ) ;
28912890 }
@@ -4000,7 +3999,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
40003999 }
40014000 }
40024001
4003- fn innermost_rib_bindings ( & mut self , ns : Namespace ) -> & mut FxHashMap < Ident , Res > {
4002+ fn innermost_rib_bindings ( & mut self , ns : Namespace ) -> & mut FxIndexMap < Ident , Res > {
40044003 & mut self . ribs [ ns] . last_mut ( ) . unwrap ( ) . bindings
40054004 }
40064005
0 commit comments