@@ -2461,8 +2461,10 @@ impl<'a> LoweringContext<'a> {
24612461
24622462 fn lower_arg ( & mut self , arg : & Arg ) -> hir:: Arg {
24632463 hir:: Arg {
2464+ attrs : self . lower_attrs ( & arg. attrs ) ,
24642465 hir_id : self . lower_node_id ( arg. id ) ,
24652466 pat : self . lower_pat ( & arg. pat ) ,
2467+ span : arg. span ,
24662468 }
24672469 }
24682470
@@ -3279,19 +3281,29 @@ impl<'a> LoweringContext<'a> {
32793281 //
32803282 // If this is the simple case, this argument will end up being the same as the
32813283 // original argument, but with a different pattern id.
3284+ let mut stmt_attrs = ThinVec :: new ( ) ;
3285+ stmt_attrs. extend ( argument. attrs . iter ( ) . cloned ( ) ) ;
32823286 let ( new_argument_pat, new_argument_id) = this. pat_ident ( desugared_span, ident) ;
32833287 let new_argument = hir:: Arg {
3288+ attrs : argument. attrs ,
32843289 hir_id : argument. hir_id ,
32853290 pat : new_argument_pat,
3291+ span : argument. span ,
32863292 } ;
32873293
3294+
32883295 if is_simple_argument {
32893296 // If this is the simple case, then we only insert one statement that is
32903297 // `let <pat> = <pat>;`. We re-use the original argument's pattern so that
32913298 // `HirId`s are densely assigned.
32923299 let expr = this. expr_ident ( desugared_span, ident, new_argument_id) ;
32933300 let stmt = this. stmt_let_pat (
3294- desugared_span, Some ( P ( expr) ) , argument. pat , hir:: LocalSource :: AsyncFn ) ;
3301+ stmt_attrs,
3302+ desugared_span,
3303+ Some ( P ( expr) ) ,
3304+ argument. pat ,
3305+ hir:: LocalSource :: AsyncFn
3306+ ) ;
32953307 statements. push ( stmt) ;
32963308 } else {
32973309 // If this is not the simple case, then we construct two statements:
@@ -3313,14 +3325,23 @@ impl<'a> LoweringContext<'a> {
33133325 desugared_span, ident, hir:: BindingAnnotation :: Mutable ) ;
33143326 let move_expr = this. expr_ident ( desugared_span, ident, new_argument_id) ;
33153327 let move_stmt = this. stmt_let_pat (
3316- desugared_span, Some ( P ( move_expr) ) , move_pat, hir:: LocalSource :: AsyncFn ) ;
3328+ ThinVec :: new ( ) ,
3329+ desugared_span,
3330+ Some ( P ( move_expr) ) ,
3331+ move_pat,
3332+ hir:: LocalSource :: AsyncFn
3333+ ) ;
33173334
33183335 // Construct the `let <pat> = __argN;` statement. We re-use the original
33193336 // argument's pattern so that `HirId`s are densely assigned.
33203337 let pattern_expr = this. expr_ident ( desugared_span, ident, move_id) ;
33213338 let pattern_stmt = this. stmt_let_pat (
3322- desugared_span, Some ( P ( pattern_expr) ) , argument. pat ,
3323- hir:: LocalSource :: AsyncFn ) ;
3339+ stmt_attrs,
3340+ desugared_span,
3341+ Some ( P ( pattern_expr) ) ,
3342+ argument. pat ,
3343+ hir:: LocalSource :: AsyncFn
3344+ ) ;
33243345
33253346 statements. push ( move_stmt) ;
33263347 statements. push ( pattern_stmt) ;
@@ -5030,6 +5051,7 @@ impl<'a> LoweringContext<'a> {
50305051
50315052 // `let mut __next`
50325053 let next_let = self . stmt_let_pat (
5054+ ThinVec :: new ( ) ,
50335055 desugared_span,
50345056 None ,
50355057 next_pat,
@@ -5039,6 +5061,7 @@ impl<'a> LoweringContext<'a> {
50395061 // `let <pat> = __next`
50405062 let pat = self . lower_pat ( pat) ;
50415063 let pat_let = self . stmt_let_pat (
5064+ ThinVec :: new ( ) ,
50425065 head_sp,
50435066 Some ( next_expr) ,
50445067 pat,
@@ -5533,19 +5556,20 @@ impl<'a> LoweringContext<'a> {
55335556
55345557 fn stmt_let_pat (
55355558 & mut self ,
5559+ attrs : ThinVec < Attribute > ,
55365560 span : Span ,
55375561 init : Option < P < hir:: Expr > > ,
55385562 pat : P < hir:: Pat > ,
55395563 source : hir:: LocalSource ,
55405564 ) -> hir:: Stmt {
55415565 let local = hir:: Local {
5542- pat,
5543- ty : None ,
5544- init,
5566+ attrs,
55455567 hir_id : self . next_id ( ) ,
5546- span,
5568+ init,
5569+ pat,
55475570 source,
5548- attrs : ThinVec :: new ( )
5571+ span,
5572+ ty : None ,
55495573 } ;
55505574 self . stmt ( span, hir:: StmtKind :: Local ( P ( local) ) )
55515575 }
@@ -5959,6 +5983,7 @@ impl<'a> LoweringContext<'a> {
59595983 hir:: BindingAnnotation :: Mutable ,
59605984 ) ;
59615985 let pinned_let = self . stmt_let_pat (
5986+ ThinVec :: new ( ) ,
59625987 span,
59635988 Some ( expr) ,
59645989 pinned_pat,
0 commit comments