@@ -448,47 +448,51 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
448448                let  arm_scope = ( arm. scope ,  arm_source_info) ; 
449449                let  match_scope = self . local_scope ( ) ; 
450450                self . in_scope ( arm_scope,  arm. lint_level ,  |this| { 
451-                     let  old_dedup_scope =
452-                         mem:: replace ( & mut  this. fixed_temps_scope ,  Some ( arm. scope ) ) ; 
453- 
454-                     // `try_to_place` may fail if it is unable to resolve the given 
455-                     // `PlaceBuilder` inside a closure. In this case, we don't want to include 
456-                     // a scrutinee place. `scrutinee_place_builder` will fail to be resolved 
457-                     // if the only match arm is a wildcard (`_`). 
458-                     // Example: 
459-                     // ``` 
460-                     // let foo = (0, 1); 
461-                     // let c = || { 
462-                     //    match foo { _ => () }; 
463-                     // }; 
464-                     // ``` 
465-                     let  scrutinee_place = scrutinee_place_builder. try_to_place ( this) ; 
466-                     let  opt_scrutinee_place =
467-                         scrutinee_place. as_ref ( ) . map ( |place| ( Some ( place) ,  scrutinee_span) ) ; 
468-                     let  scope = this. declare_bindings ( 
469-                         None , 
470-                         arm. span , 
471-                         & arm. pattern , 
472-                         arm. guard , 
473-                         opt_scrutinee_place, 
474-                     ) ; 
451+                     let  guard_scope =
452+                         region:: Scope  {  data :  region:: ScopeData :: IfThenRescope ,  ..arm. scope  } ; 
453+                     this. in_scope ( ( guard_scope,  arm_source_info) ,  LintLevel :: Inherited ,  |this| { 
454+                         let  old_dedup_scope =
455+                             mem:: replace ( & mut  this. fixed_temps_scope ,  Some ( guard_scope) ) ; 
456+ 
457+                         // `try_to_place` may fail if it is unable to resolve the given 
458+                         // `PlaceBuilder` inside a closure. In this case, we don't want to include 
459+                         // a scrutinee place. `scrutinee_place_builder` will fail to be resolved 
460+                         // if the only match arm is a wildcard (`_`). 
461+                         // Example: 
462+                         // ``` 
463+                         // let foo = (0, 1); 
464+                         // let c = || { 
465+                         //    match foo { _ => () }; 
466+                         // }; 
467+                         // ``` 
468+                         let  scrutinee_place = scrutinee_place_builder. try_to_place ( this) ; 
469+                         let  opt_scrutinee_place =
470+                             scrutinee_place. as_ref ( ) . map ( |place| ( Some ( place) ,  scrutinee_span) ) ; 
471+                         let  scope = this. declare_bindings ( 
472+                             None , 
473+                             arm. span , 
474+                             & arm. pattern , 
475+                             arm. guard , 
476+                             opt_scrutinee_place, 
477+                         ) ; 
475478
476-                     let  arm_block = this. bind_pattern ( 
477-                         outer_source_info, 
478-                         branch, 
479-                         & built_match_tree. fake_borrow_temps , 
480-                         scrutinee_span, 
481-                         Some ( ( arm,  match_scope) ) , 
482-                         EmitStorageLive :: Yes , 
483-                     ) ; 
479+                          let  arm_block = this. bind_pattern ( 
480+                              outer_source_info, 
481+                              branch, 
482+                              & built_match_tree. fake_borrow_temps , 
483+                              scrutinee_span, 
484+                              Some ( ( arm,  match_scope) ) , 
485+                              EmitStorageLive :: Yes , 
486+                          ) ; 
484487
485-                     this. fixed_temps_scope  = old_dedup_scope; 
488+                          this. fixed_temps_scope  = old_dedup_scope; 
486489
487-                     if  let  Some ( source_scope)  = scope { 
488-                         this. source_scope  = source_scope; 
489-                     } 
490+                          if  let  Some ( source_scope)  = scope { 
491+                              this. source_scope  = source_scope; 
492+                          } 
490493
491-                     this. expr_into_dest ( destination,  arm_block,  arm. body ) 
494+                         this. expr_into_dest ( destination,  arm_block,  arm. body ) 
495+                     } ) 
492496                } ) 
493497                . into_block ( ) 
494498            } ) 
@@ -569,7 +573,7 @@ impl<'a, 'tcx> Builder<'a, 'tcx> {
569573            // be bound for each candidate. 
570574            for  sub_branch in  branch. sub_branches  { 
571575                if  let  Some ( arm)  = arm { 
572-                     self . clear_top_scope ( arm. scope ) ; 
576+                     self . clear_match_arm_scope ( arm. scope ) ; 
573577                } 
574578                let  binding_end = self . bind_and_guard_matched_candidate ( 
575579                    sub_branch, 
0 commit comments