@@ -703,7 +703,8 @@ impl ExprCollector<'_> {
703703 let Some ( try_from_output) = LangItem :: TryTraitFromOutput . path ( self . db , self . krate ) else {
704704 return self . collect_block ( e) ;
705705 } ;
706- let label = self . alloc_label_desugared ( Label { name : Name :: generate_new_name ( ) } ) ;
706+ let label = self
707+ . alloc_label_desugared ( Label { name : Name :: generate_new_name ( self . body . labels . len ( ) ) } ) ;
707708 let old_label = self . current_try_block_label . replace ( label) ;
708709
709710 let ( btail, expr_id) = self . with_labeled_rib ( label, |this| {
@@ -840,7 +841,7 @@ impl ExprCollector<'_> {
840841 this. collect_expr_opt ( e. loop_body ( ) . map ( |it| it. into ( ) ) )
841842 } ) ,
842843 } ;
843- let iter_name = Name :: generate_new_name ( ) ;
844+ let iter_name = Name :: generate_new_name ( self . body . exprs . len ( ) ) ;
844845 let iter_expr = self . alloc_expr ( Expr :: Path ( Path :: from ( iter_name. clone ( ) ) ) , syntax_ptr) ;
845846 let iter_expr_mut = self . alloc_expr (
846847 Expr :: Ref { expr : iter_expr, rawness : Rawness :: Ref , mutability : Mutability :: Mut } ,
@@ -901,7 +902,7 @@ impl ExprCollector<'_> {
901902 Expr :: Call { callee : try_branch, args : Box :: new ( [ operand] ) , is_assignee_expr : false } ,
902903 syntax_ptr,
903904 ) ;
904- let continue_name = Name :: generate_new_name ( ) ;
905+ let continue_name = Name :: generate_new_name ( self . body . bindings . len ( ) ) ;
905906 let continue_binding =
906907 self . alloc_binding ( continue_name. clone ( ) , BindingAnnotation :: Unannotated ) ;
907908 let continue_bpat =
@@ -916,7 +917,7 @@ impl ExprCollector<'_> {
916917 guard : None ,
917918 expr : self . alloc_expr ( Expr :: Path ( Path :: from ( continue_name) ) , syntax_ptr) ,
918919 } ;
919- let break_name = Name :: generate_new_name ( ) ;
920+ let break_name = Name :: generate_new_name ( self . body . bindings . len ( ) ) ;
920921 let break_binding = self . alloc_binding ( break_name. clone ( ) , BindingAnnotation :: Unannotated ) ;
921922 let break_bpat = self . alloc_pat_desugared ( Pat :: Bind { id : break_binding, subpat : None } ) ;
922923 self . add_definition_to_binding ( break_binding, break_bpat) ;
0 commit comments