@@ -762,12 +762,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
762762 if let Some ( rib) = & self . last_block_rib
763763 && let RibKind :: Normal = rib. kind
764764 {
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 {
771766 if let Res :: Local ( _) = res
772767 && path. len ( ) == 1
773768 && ident. span . eq_ctxt ( path[ 0 ] . ident . span )
@@ -949,12 +944,7 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
949944 if let Some ( err_code) = err. code {
950945 if err_code == E0425 {
951946 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 {
958948 let ident = path. last ( ) . unwrap ( ) . ident ;
959949 if format ! ( "'{ident}" ) == label_ident. to_string ( ) {
960950 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> {
21522142 } ;
21532143
21542144 // Locals and type parameters
2155- // `names` is sorted below so ordering is not important here.
2156- #[ allow( rustc:: potential_query_instability) ]
21572145 for ( ident, & res) in & rib. bindings {
21582146 if filter_fn ( res) && ident. span . ctxt ( ) == rib_ctxt {
21592147 names. push ( TypoSuggestion :: typo_from_ident ( * ident, res) ) ;
@@ -2617,28 +2605,18 @@ impl<'ast, 'ra: 'ast, 'tcx> LateResolutionVisitor<'_, 'ast, 'ra, 'tcx> {
26172605 let within_scope = self . is_label_valid_from_rib ( rib_index) ;
26182606
26192607 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
26232609 . bindings
26242610 . iter ( )
26252611 . filter ( |( id, _) | id. span . eq_ctxt ( label. span ) )
26262612 . map ( |( id, _) | id. name )
26272613 . collect :: < Vec < Symbol > > ( ) ;
26282614
2629- // Make sure error reporting is deterministic.
2630- names. sort ( ) ;
2631-
26322615 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-
26382616 // Upon finding a similar name, get the ident that it was from - the span
26392617 // contained within helps make a useful diagnostic. In addition, determine
26402618 // 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 ( ) ;
26422620 ( * ident, within_scope)
26432621 } )
26442622 }
0 commit comments