@@ -1039,10 +1039,9 @@ impl LoweringContext<'_> {
10391039 ) -> hir:: Expr {
10401040 // expand <head>
10411041 let mut head = self . lower_expr ( head) ;
1042- let head_sp = head. span ;
10431042 let desugared_span = self . mark_span_with_reason (
10441043 DesugaringKind :: ForLoop ,
1045- head_sp ,
1044+ head . span ,
10461045 None ,
10471046 ) ;
10481047 head. span = desugared_span;
@@ -1088,21 +1087,21 @@ impl LoweringContext<'_> {
10881087
10891088 // `match ::std::iter::Iterator::next(&mut iter) { ... }`
10901089 let match_expr = {
1091- let iter = P ( self . expr_ident ( head_sp , iter, iter_pat_nid) ) ;
1092- let ref_mut_iter = self . expr_mut_addr_of ( head_sp , iter) ;
1090+ let iter = P ( self . expr_ident ( desugared_span , iter, iter_pat_nid) ) ;
1091+ let ref_mut_iter = self . expr_mut_addr_of ( desugared_span , iter) ;
10931092 let next_path = & [ sym:: iter, sym:: Iterator , sym:: next] ;
10941093 let next_expr = P ( self . expr_call_std_path (
1095- head_sp ,
1094+ desugared_span ,
10961095 next_path,
10971096 hir_vec ! [ ref_mut_iter] ,
10981097 ) ) ;
10991098 let arms = hir_vec ! [ pat_arm, break_arm] ;
11001099
1101- self . expr_match ( head_sp , next_expr, arms, hir:: MatchSource :: ForLoopDesugar )
1100+ self . expr_match ( desugared_span , next_expr, arms, hir:: MatchSource :: ForLoopDesugar )
11021101 } ;
1103- let match_stmt = self . stmt_expr ( head_sp , match_expr) ;
1102+ let match_stmt = self . stmt_expr ( desugared_span , match_expr) ;
11041103
1105- let next_expr = P ( self . expr_ident ( head_sp , next_ident, next_pat_hid) ) ;
1104+ let next_expr = P ( self . expr_ident ( desugared_span , next_ident, next_pat_hid) ) ;
11061105
11071106 // `let mut __next`
11081107 let next_let = self . stmt_let_pat (
@@ -1117,7 +1116,7 @@ impl LoweringContext<'_> {
11171116 let pat = self . lower_pat ( pat) ;
11181117 let pat_let = self . stmt_let_pat (
11191118 ThinVec :: new ( ) ,
1120- head_sp ,
1119+ desugared_span ,
11211120 Some ( next_expr) ,
11221121 pat,
11231122 hir:: LocalSource :: ForLoopDesugar ,
@@ -1154,14 +1153,14 @@ impl LoweringContext<'_> {
11541153 let into_iter_path =
11551154 & [ sym:: iter, sym:: IntoIterator , sym:: into_iter] ;
11561155 P ( self . expr_call_std_path (
1157- head_sp ,
1156+ desugared_span ,
11581157 into_iter_path,
11591158 hir_vec ! [ head] ,
11601159 ) )
11611160 } ;
11621161
11631162 let match_expr = P ( self . expr_match (
1164- head_sp ,
1163+ desugared_span ,
11651164 into_iter_expr,
11661165 hir_vec ! [ iter_arm] ,
11671166 hir:: MatchSource :: ForLoopDesugar ,
@@ -1173,7 +1172,7 @@ impl LoweringContext<'_> {
11731172 // surrounding scope of the `match` since the `match` is not a terminating scope.
11741173 //
11751174 // Also, add the attributes to the outer returned expr node.
1176- self . expr_drop_temps ( head_sp , match_expr, e. attrs . clone ( ) )
1175+ self . expr_drop_temps ( desugared_span , match_expr, e. attrs . clone ( ) )
11771176 }
11781177
11791178 /// Desugar `ExprKind::Try` from: `<expr>?` into:
0 commit comments