@@ -762,12 +762,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
762
762
if let Some ( rib) = & self . last_block_rib
763
763
&& let RibKind :: Normal = rib. kind
764
764
{
765
- // It is sorted before usage so ordering is not important here.
766
- #[ allow( rustc:: potential_query_instability) ]
767
- let mut bindings: Vec < _ > = rib. bindings . clone ( ) . into_iter ( ) . collect ( ) ;
768
- bindings. sort_by_key ( |( ident, _) | ident. span ) ;
769
-
770
- for ( ident, res) in & bindings {
765
+ for ( ident, & res) in & rib. bindings {
771
766
if let Res :: Local ( _) = res
772
767
&& path. len ( ) == 1
773
768
&& ident. span . eq_ctxt ( path[ 0 ] . ident . span )
@@ -949,12 +944,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
949
944
if let Some ( err_code) = err. code {
950
945
if err_code == E0425 {
951
946
for label_rib in & self . label_ribs {
952
- // It is sorted before usage so ordering is not important here.
953
- #[ allow( rustc:: potential_query_instability) ]
954
- let mut bindings: Vec < _ > = label_rib. bindings . clone ( ) . into_iter ( ) . collect ( ) ;
955
- bindings. sort_by_key ( |( ident, _) | ident. span ) ;
956
-
957
- for ( label_ident, node_id) in & bindings {
947
+ for ( label_ident, node_id) in & label_rib. bindings {
958
948
let ident = path. last ( ) . unwrap ( ) . ident ;
959
949
if format ! ( "'{ident}" ) == label_ident. to_string ( ) {
960
950
err. span_label ( label_ident. span , "a label with a similar name exists" ) ;
@@ -2152,8 +2142,6 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
2152
2142
} ;
2153
2143
2154
2144
// Locals and type parameters
2155
- // `names` is sorted below so ordering is not important here.
2156
- #[ allow( rustc:: potential_query_instability) ]
2157
2145
for ( ident, & res) in & rib. bindings {
2158
2146
if filter_fn ( res) && ident. span . ctxt ( ) == rib_ctxt {
2159
2147
names. push ( TypoSuggestion :: typo_from_ident ( * ident, res) ) ;
@@ -2617,28 +2605,18 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
2617
2605
let within_scope = self . is_label_valid_from_rib ( rib_index) ;
2618
2606
2619
2607
let rib = & self . label_ribs [ rib_index] ;
2620
- // `names` is sorted below so ordering is not important here.
2621
- #[ allow( rustc:: potential_query_instability) ]
2622
- let mut names = rib
2608
+ let names = rib
2623
2609
. bindings
2624
2610
. iter ( )
2625
2611
. filter ( |( id, _) | id. span . eq_ctxt ( label. span ) )
2626
2612
. map ( |( id, _) | id. name )
2627
2613
. collect :: < Vec < Symbol > > ( ) ;
2628
2614
2629
- // Make sure error reporting is deterministic.
2630
- names. sort ( ) ;
2631
-
2632
2615
find_best_match_for_name ( & names, label. name , None ) . map ( |symbol| {
2633
- // It is sorted before usage so ordering is not important here.
2634
- #[ allow( rustc:: potential_query_instability) ]
2635
- let mut bindings: Vec < _ > = rib. bindings . clone ( ) . into_iter ( ) . collect ( ) ;
2636
- bindings. sort_by_key ( |( ident, _) | ident. span ) ;
2637
-
2638
2616
// Upon finding a similar name, get the ident that it was from - the span
2639
2617
// contained within helps make a useful diagnostic. In addition, determine
2640
2618
// whether this candidate is within scope.
2641
- let ( ident, _) = bindings. iter ( ) . find ( |( ident, _) | ident. name == symbol) . unwrap ( ) ;
2619
+ let ( ident, _) = rib . bindings . iter ( ) . find ( |( ident, _) | ident. name == symbol) . unwrap ( ) ;
2642
2620
( * ident, within_scope)
2643
2621
} )
2644
2622
}
0 commit comments