@@ -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}
@@ -1642,8 +1642,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
16421642
16431643 // Allow all following defaults to refer to this type parameter.
16441644 let i = & Ident :: with_dummy_span ( param. ident . name ) ;
1645- forward_ty_ban_rib. bindings . remove ( i) ;
1646- forward_ty_ban_rib_const_param_ty. bindings . remove ( i) ;
1645+ forward_ty_ban_rib. bindings . swap_remove ( i) ;
1646+ forward_ty_ban_rib_const_param_ty. bindings . swap_remove ( i) ;
16471647 }
16481648 GenericParamKind :: Const { ref ty, kw_span : _, ref default } => {
16491649 // Const parameters can't have param bounds.
@@ -1678,8 +1678,8 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
16781678
16791679 // Allow all following defaults to refer to this const parameter.
16801680 let i = & Ident :: with_dummy_span ( param. ident . name ) ;
1681- forward_const_ban_rib. bindings . remove ( i) ;
1682- forward_const_ban_rib_const_param_ty. bindings . remove ( i) ;
1681+ forward_const_ban_rib. bindings . swap_remove ( i) ;
1682+ forward_const_ban_rib_const_param_ty. bindings . swap_remove ( i) ;
16831683 }
16841684 }
16851685 }
@@ -2888,7 +2888,6 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
28882888 break ;
28892889 }
28902890
2891- #[ allow( rustc:: potential_query_instability) ] // FIXME
28922891 seen_bindings
28932892 . extend ( parent_rib. bindings . keys ( ) . map ( |ident| ( * ident, ident. span ) ) ) ;
28942893 }
@@ -4003,7 +4002,7 @@ impl<'a, 'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'a, 'ast, 'ra, 'tcx> {
40034002 }
40044003 }
40054004
4006- fn innermost_rib_bindings ( & mut self , ns : Namespace ) -> & mut FxHashMap < Ident , Res > {
4005+ fn innermost_rib_bindings ( & mut self , ns : Namespace ) -> & mut FxIndexMap < Ident , Res > {
40074006 & mut self . ribs [ ns] . last_mut ( ) . unwrap ( ) . bindings
40084007 }
40094008
0 commit comments