@@ -1156,7 +1156,7 @@ impl<'a> LoweringContext<'a> {
11561156 bounds. iter ( ) . map ( |bound| self . lower_ty_param_bound ( bound) ) . collect ( )
11571157 }
11581158
1159- fn lower_block ( & mut self , b : & Block , break_to : Option < NodeId > ) -> P < hir:: Block > {
1159+ fn lower_block ( & mut self , b : & Block , targeted_by_break : bool ) -> P < hir:: Block > {
11601160 let mut expr = None ;
11611161
11621162 let mut stmts = vec ! [ ] ;
@@ -1179,7 +1179,7 @@ impl<'a> LoweringContext<'a> {
11791179 expr : expr,
11801180 rules : self . lower_block_check_mode ( & b. rules ) ,
11811181 span : b. span ,
1182- break_to_expr_id : break_to ,
1182+ targeted_by_break : targeted_by_break ,
11831183 } )
11841184 }
11851185
@@ -1274,7 +1274,7 @@ impl<'a> LoweringContext<'a> {
12741274 }
12751275 ItemKind :: Fn ( ref decl, unsafety, constness, abi, ref generics, ref body) => {
12761276 self . with_new_scopes ( |this| {
1277- let body = this. lower_block ( body, None ) ;
1277+ let body = this. lower_block ( body, false ) ;
12781278 let body = this. expr_block ( body, ThinVec :: new ( ) ) ;
12791279 let body_id = this. record_body ( body, Some ( decl) ) ;
12801280 hir:: ItemFn ( this. lower_fn_decl ( decl) ,
@@ -1368,7 +1368,7 @@ impl<'a> LoweringContext<'a> {
13681368 hir:: TraitMethod :: Required ( names) )
13691369 }
13701370 TraitItemKind :: Method ( ref sig, Some ( ref body) ) => {
1371- let body = this. lower_block ( body, None ) ;
1371+ let body = this. lower_block ( body, false ) ;
13721372 let expr = this. expr_block ( body, ThinVec :: new ( ) ) ;
13731373 let body_id = this. record_body ( expr, Some ( & sig. decl ) ) ;
13741374 hir:: TraitItemKind :: Method ( this. lower_method_sig ( sig) ,
@@ -1424,7 +1424,7 @@ impl<'a> LoweringContext<'a> {
14241424 hir:: ImplItemKind :: Const ( this. lower_ty ( ty) , body_id)
14251425 }
14261426 ImplItemKind :: Method ( ref sig, ref body) => {
1427- let body = this. lower_block ( body, None ) ;
1427+ let body = this. lower_block ( body, false ) ;
14281428 let expr = this. expr_block ( body, ThinVec :: new ( ) ) ;
14291429 let body_id = this. record_body ( expr, Some ( & sig. decl ) ) ;
14301430 hir:: ImplItemKind :: Method ( this. lower_method_sig ( sig) , body_id)
@@ -1848,15 +1848,15 @@ impl<'a> LoweringContext<'a> {
18481848 id : id,
18491849 rules : hir:: DefaultBlock ,
18501850 span : span,
1851- break_to_expr_id : None ,
1851+ targeted_by_break : false ,
18521852 } ) ;
18531853 P ( self . expr_block ( blk, ThinVec :: new ( ) ) )
18541854 }
18551855 _ => P ( self . lower_expr ( els) ) ,
18561856 }
18571857 } ) ;
18581858
1859- let then_blk = self . lower_block ( blk, None ) ;
1859+ let then_blk = self . lower_block ( blk, false ) ;
18601860 let then_expr = self . expr_block ( then_blk, ThinVec :: new ( ) ) ;
18611861
18621862 hir:: ExprIf ( P ( self . lower_expr ( cond) ) , P ( then_expr) , else_opt)
@@ -1865,18 +1865,18 @@ impl<'a> LoweringContext<'a> {
18651865 self . with_loop_scope ( e. id , |this|
18661866 hir:: ExprWhile (
18671867 this. with_loop_condition_scope ( |this| P ( this. lower_expr ( cond) ) ) ,
1868- this. lower_block ( body, None ) ,
1868+ this. lower_block ( body, false ) ,
18691869 this. lower_opt_sp_ident ( opt_ident) ) )
18701870 }
18711871 ExprKind :: Loop ( ref body, opt_ident) => {
18721872 self . with_loop_scope ( e. id , |this|
1873- hir:: ExprLoop ( this. lower_block ( body, None ) ,
1873+ hir:: ExprLoop ( this. lower_block ( body, false ) ,
18741874 this. lower_opt_sp_ident ( opt_ident) ,
18751875 hir:: LoopSource :: Loop ) )
18761876 }
18771877 ExprKind :: Catch ( ref body) => {
1878- self . with_catch_scope ( e . id , |this|
1879- hir:: ExprBlock ( this. lower_block ( body, Some ( e . id ) ) ) )
1878+ self . with_catch_scope ( body . id , |this|
1879+ hir:: ExprBlock ( this. lower_block ( body, true ) ) )
18801880 }
18811881 ExprKind :: Match ( ref expr, ref arms) => {
18821882 hir:: ExprMatch ( P ( self . lower_expr ( expr) ) ,
@@ -1894,7 +1894,7 @@ impl<'a> LoweringContext<'a> {
18941894 } )
18951895 } )
18961896 }
1897- ExprKind :: Block ( ref blk) => hir:: ExprBlock ( self . lower_block ( blk, None ) ) ,
1897+ ExprKind :: Block ( ref blk) => hir:: ExprBlock ( self . lower_block ( blk, false ) ) ,
18981898 ExprKind :: Assign ( ref el, ref er) => {
18991899 hir:: ExprAssign ( P ( self . lower_expr ( el) ) , P ( self . lower_expr ( er) ) )
19001900 }
@@ -2040,7 +2040,7 @@ impl<'a> LoweringContext<'a> {
20402040
20412041 // `<pat> => <body>`
20422042 {
2043- let body = self . lower_block ( body, None ) ;
2043+ let body = self . lower_block ( body, false ) ;
20442044 let body_expr = P ( self . expr_block ( body, ThinVec :: new ( ) ) ) ;
20452045 let pat = self . lower_pat ( pat) ;
20462046 arms. push ( self . arm ( hir_vec ! [ pat] , body_expr) ) ;
@@ -2112,7 +2112,7 @@ impl<'a> LoweringContext<'a> {
21122112 let ( guard, body) = if let ExprKind :: If ( ref cond,
21132113 ref then,
21142114 _) = else_expr. node {
2115- let then = self . lower_block ( then, None ) ;
2115+ let then = self . lower_block ( then, false ) ;
21162116 ( Some ( cond) ,
21172117 self . expr_block ( then, ThinVec :: new ( ) ) )
21182118 } else {
@@ -2162,7 +2162,7 @@ impl<'a> LoweringContext<'a> {
21622162 // Note that the block AND the condition are evaluated in the loop scope.
21632163 // This is done to allow `break` from inside the condition of the loop.
21642164 let ( body, break_expr, sub_expr) = self . with_loop_scope ( e. id , |this| (
2165- this. lower_block ( body, None ) ,
2165+ this. lower_block ( body, false ) ,
21662166 this. expr_break ( e. span , ThinVec :: new ( ) ) ,
21672167 this. with_loop_condition_scope ( |this| P ( this. lower_expr ( sub_expr) ) ) ,
21682168 ) ) ;
@@ -2223,7 +2223,7 @@ impl<'a> LoweringContext<'a> {
22232223 // `::std::option::Option::Some(<pat>) => <body>`
22242224 let pat_arm = {
22252225 let body_block = self . with_loop_scope ( e. id ,
2226- |this| this. lower_block ( body, None ) ) ;
2226+ |this| this. lower_block ( body, false ) ) ;
22272227 let body_expr = P ( self . expr_block ( body_block, ThinVec :: new ( ) ) ) ;
22282228 let pat = self . lower_pat ( pat) ;
22292229 let some_pat = self . pat_some ( e. span , pat) ;
@@ -2655,7 +2655,7 @@ impl<'a> LoweringContext<'a> {
26552655 id : self . next_id ( ) ,
26562656 rules : hir:: DefaultBlock ,
26572657 span : span,
2658- break_to_expr_id : None ,
2658+ targeted_by_break : false ,
26592659 }
26602660 }
26612661
@@ -2763,7 +2763,7 @@ impl<'a> LoweringContext<'a> {
27632763 id : id,
27642764 stmts : stmts,
27652765 expr : Some ( expr) ,
2766- break_to_expr_id : None ,
2766+ targeted_by_break : false ,
27672767 } ) ;
27682768 self . expr_block ( block, attrs)
27692769 }
0 commit comments