@@ -326,17 +326,19 @@ impl<'a> LoweringContext<'a> {
326326 o_id. map ( |sp_ident| respan ( sp_ident. span , sp_ident. node . name ) )
327327 }
328328
329- fn lower_label ( & mut self , label : Option < ( NodeId , Spanned < Ident > ) > ) -> hir:: Label {
330- match label {
331- Some ( ( id, label_ident) ) => hir:: Label {
329+ fn lower_destination ( & mut self , destination : Option < ( NodeId , Spanned < Ident > ) > )
330+ -> hir:: Destination
331+ {
332+ match destination {
333+ Some ( ( id, label_ident) ) => hir:: Destination {
332334 ident : Some ( label_ident) ,
333335 loop_id : if let Def :: Label ( loop_id) = self . expect_full_def ( id) {
334336 hir:: LoopIdResult :: Ok ( loop_id)
335337 } else {
336338 hir:: LoopIdResult :: Err ( hir:: LoopIdError :: UnresolvedLabel )
337339 }
338340 } ,
339- None => hir:: Label {
341+ None => hir:: Destination {
340342 ident : None ,
341343 loop_id : self . loop_scopes . last ( ) . map ( |innermost_loop_id| Ok ( * innermost_loop_id) )
342344 . unwrap_or ( Err ( hir:: LoopIdError :: OutsideLoopScope ) ) . into ( )
@@ -1729,12 +1731,12 @@ impl<'a> LoweringContext<'a> {
17291731 }
17301732 ExprKind :: Break ( opt_ident, ref opt_expr) => {
17311733 let label_result = if self . is_in_loop_condition && opt_ident. is_none ( ) {
1732- hir:: Label {
1734+ hir:: Destination {
17331735 ident : opt_ident,
17341736 loop_id : Err ( hir:: LoopIdError :: UnlabeledCfInWhileCondition ) . into ( ) ,
17351737 }
17361738 } else {
1737- self . lower_label ( opt_ident. map ( |ident| ( e. id , ident) ) )
1739+ self . lower_destination ( opt_ident. map ( |ident| ( e. id , ident) ) )
17381740 } ;
17391741 hir:: ExprBreak (
17401742 label_result,
@@ -1743,13 +1745,13 @@ impl<'a> LoweringContext<'a> {
17431745 ExprKind :: Continue ( opt_ident) =>
17441746 hir:: ExprAgain (
17451747 if self . is_in_loop_condition && opt_ident. is_none ( ) {
1746- hir:: Label {
1748+ hir:: Destination {
17471749 ident : opt_ident,
17481750 loop_id : Err (
17491751 hir:: LoopIdError :: UnlabeledCfInWhileCondition ) . into ( ) ,
17501752 }
17511753 } else {
1752- self . lower_label ( opt_ident. map ( | ident| ( e. id , ident) ) )
1754+ self . lower_destination ( opt_ident. map ( |ident| ( e. id , ident) ) )
17531755 } ) ,
17541756 ExprKind :: Ret ( ref e) => hir:: ExprRet ( e. as_ref ( ) . map ( |x| P ( self . lower_expr ( x) ) ) ) ,
17551757 ExprKind :: InlineAsm ( ref asm) => {
@@ -2244,7 +2246,7 @@ impl<'a> LoweringContext<'a> {
22442246 }
22452247
22462248 fn expr_break ( & mut self , span : Span , attrs : ThinVec < Attribute > ) -> P < hir:: Expr > {
2247- let expr_break = hir:: ExprBreak ( self . lower_label ( None ) , None ) ;
2249+ let expr_break = hir:: ExprBreak ( self . lower_destination ( None ) , None ) ;
22482250 P ( self . expr ( span, expr_break, attrs) )
22492251 }
22502252
0 commit comments