@@ -4058,16 +4058,16 @@ impl<'a> LoweringContext<'a> {
40584058 // expand <head>
40594059 let head = self . lower_expr ( head) ;
40604060 let head_sp = head. span ;
4061+ let desugared_span = self . allow_internal_unstable (
4062+ CompilerDesugaringKind :: ForLoop ,
4063+ head. span ,
4064+ ) ;
40614065
40624066 let iter = self . str_to_ident ( "iter" ) ;
40634067
40644068 let next_ident = self . str_to_ident ( "__next" ) ;
4065- let next_sp = self . allow_internal_unstable (
4066- CompilerDesugaringKind :: ForLoop ,
4067- head_sp,
4068- ) ;
40694069 let next_pat = self . pat_ident_binding_mode (
4070- next_sp ,
4070+ desugared_span ,
40714071 next_ident,
40724072 hir:: BindingAnnotation :: Mutable ,
40734073 ) ;
@@ -4096,8 +4096,11 @@ impl<'a> LoweringContext<'a> {
40964096 } ;
40974097
40984098 // `mut iter`
4099- let iter_pat =
4100- self . pat_ident_binding_mode ( head_sp, iter, hir:: BindingAnnotation :: Mutable ) ;
4099+ let iter_pat = self . pat_ident_binding_mode (
4100+ desugared_span,
4101+ iter,
4102+ hir:: BindingAnnotation :: Mutable
4103+ ) ;
41014104
41024105 // `match ::std::iter::Iterator::next(&mut iter) { ... }`
41034106 let match_expr = {
@@ -4126,8 +4129,12 @@ impl<'a> LoweringContext<'a> {
41264129 let next_expr = P ( self . expr_ident ( head_sp, next_ident, next_pat. id ) ) ;
41274130
41284131 // `let mut __next`
4129- let next_let =
4130- self . stmt_let_pat ( head_sp, None , next_pat, hir:: LocalSource :: ForLoopDesugar ) ;
4132+ let next_let = self . stmt_let_pat (
4133+ desugared_span,
4134+ None ,
4135+ next_pat,
4136+ hir:: LocalSource :: ForLoopDesugar ,
4137+ ) ;
41314138
41324139 // `let <pat> = __next`
41334140 let pat = self . lower_pat ( pat) ;
0 commit comments