@@ -4058,16 +4058,16 @@ impl<'a> LoweringContext<'a> {
4058
4058
// expand <head>
4059
4059
let head = self . lower_expr ( head) ;
4060
4060
let head_sp = head. span ;
4061
+ let desugared_span = self . allow_internal_unstable (
4062
+ CompilerDesugaringKind :: ForLoop ,
4063
+ head. span ,
4064
+ ) ;
4061
4065
4062
4066
let iter = self . str_to_ident ( "iter" ) ;
4063
4067
4064
4068
let next_ident = self . str_to_ident ( "__next" ) ;
4065
- let next_sp = self . allow_internal_unstable (
4066
- CompilerDesugaringKind :: ForLoop ,
4067
- head_sp,
4068
- ) ;
4069
4069
let next_pat = self . pat_ident_binding_mode (
4070
- next_sp ,
4070
+ desugared_span ,
4071
4071
next_ident,
4072
4072
hir:: BindingAnnotation :: Mutable ,
4073
4073
) ;
@@ -4096,8 +4096,11 @@ impl<'a> LoweringContext<'a> {
4096
4096
} ;
4097
4097
4098
4098
// `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
+ ) ;
4101
4104
4102
4105
// `match ::std::iter::Iterator::next(&mut iter) { ... }`
4103
4106
let match_expr = {
@@ -4126,8 +4129,12 @@ impl<'a> LoweringContext<'a> {
4126
4129
let next_expr = P ( self . expr_ident ( head_sp, next_ident, next_pat. id ) ) ;
4127
4130
4128
4131
// `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
+ ) ;
4131
4138
4132
4139
// `let <pat> = __next`
4133
4140
let pat = self . lower_pat ( pat) ;
0 commit comments