@@ -1957,7 +1957,7 @@ impl<'a> LoweringContext<'a> {
1957
1957
)
1958
1958
}
1959
1959
1960
- fn lower_local ( & mut self , l : & Local ) -> ( P < hir:: Local > , SmallVec < [ hir:: ItemId ; 1 ] > ) {
1960
+ fn lower_local ( & mut self , l : & Local ) -> ( hir:: Local , SmallVec < [ hir:: ItemId ; 1 ] > ) {
1961
1961
let LoweredNodeId { node_id, hir_id } = self . lower_node_id ( l. id ) ;
1962
1962
let mut ids = SmallVec :: < [ hir:: ItemId ; 1 ] > :: new ( ) ;
1963
1963
if self . sess . features_untracked ( ) . impl_trait_in_bindings {
@@ -1967,7 +1967,7 @@ impl<'a> LoweringContext<'a> {
1967
1967
}
1968
1968
}
1969
1969
let parent_def_id = DefId :: local ( self . current_hir_id_owner . last ( ) . unwrap ( ) . 0 ) ;
1970
- ( P ( hir:: Local {
1970
+ ( hir:: Local {
1971
1971
id : node_id,
1972
1972
hir_id,
1973
1973
ty : l. ty
@@ -1984,7 +1984,7 @@ impl<'a> LoweringContext<'a> {
1984
1984
span : l. span ,
1985
1985
attrs : l. attrs . clone ( ) ,
1986
1986
source : hir:: LocalSource :: Normal ,
1987
- } ) , ids)
1987
+ } , ids)
1988
1988
}
1989
1989
1990
1990
fn lower_mutability ( & mut self , m : Mutability ) -> hir:: Mutability {
@@ -4331,10 +4331,11 @@ impl<'a> LoweringContext<'a> {
4331
4331
ThinVec :: new ( ) ,
4332
4332
) )
4333
4333
} ;
4334
- let match_stmt = respan (
4335
- head_sp,
4336
- hir:: StmtKind :: Expr ( match_expr, self . next_id ( ) . node_id )
4337
- ) ;
4334
+ let match_stmt = hir:: Stmt {
4335
+ id : self . next_id ( ) . node_id ,
4336
+ node : hir:: StmtKind :: Expr ( match_expr) ,
4337
+ span : head_sp,
4338
+ } ;
4338
4339
4339
4340
let next_expr = P ( self . expr_ident ( head_sp, next_ident, next_pat. id ) ) ;
4340
4341
@@ -4357,10 +4358,11 @@ impl<'a> LoweringContext<'a> {
4357
4358
4358
4359
let body_block = self . with_loop_scope ( e. id , |this| this. lower_block ( body, false ) ) ;
4359
4360
let body_expr = P ( self . expr_block ( body_block, ThinVec :: new ( ) ) ) ;
4360
- let body_stmt = respan (
4361
- body. span ,
4362
- hir:: StmtKind :: Expr ( body_expr, self . next_id ( ) . node_id )
4363
- ) ;
4361
+ let body_stmt = hir:: Stmt {
4362
+ id : self . next_id ( ) . node_id ,
4363
+ node : hir:: StmtKind :: Expr ( body_expr) ,
4364
+ span : body. span ,
4365
+ } ;
4364
4366
4365
4367
let loop_block = P ( self . block_all (
4366
4368
e. span ,
@@ -4533,25 +4535,15 @@ impl<'a> LoweringContext<'a> {
4533
4535
let ( l, item_ids) = self . lower_local( l) ;
4534
4536
let mut ids: SmallVec <[ hir:: Stmt ; 1 ] > = item_ids
4535
4537
. into_iter( )
4536
- . map( |item_id| Spanned {
4537
- node: hir:: StmtKind :: Decl (
4538
- P ( Spanned {
4539
- node: hir:: DeclKind :: Item ( item_id) ,
4540
- span: s. span,
4541
- } ) ,
4542
- self . next_id( ) . node_id,
4543
- ) ,
4538
+ . map( |item_id| hir:: Stmt {
4539
+ id: self . next_id( ) . node_id,
4540
+ node: hir:: StmtKind :: Item ( P ( item_id) ) ,
4544
4541
span: s. span,
4545
4542
} )
4546
4543
. collect( ) ;
4547
- ids. push( Spanned {
4548
- node: hir:: StmtKind :: Decl (
4549
- P ( Spanned {
4550
- node: hir:: DeclKind :: Local ( l) ,
4551
- span: s. span,
4552
- } ) ,
4553
- self . lower_node_id( s. id) . node_id,
4554
- ) ,
4544
+ ids. push( hir:: Stmt {
4545
+ id: self . lower_node_id( s. id) . node_id,
4546
+ node: hir:: StmtKind :: Local ( P ( l) ) ,
4555
4547
span: s. span,
4556
4548
} ) ;
4557
4549
return ids;
@@ -4561,26 +4553,23 @@ impl<'a> LoweringContext<'a> {
4561
4553
let mut id = Some ( s. id) ;
4562
4554
return self . lower_item_id( it)
4563
4555
. into_iter( )
4564
- . map( |item_id| Spanned {
4565
- node: hir:: StmtKind :: Decl (
4566
- P ( Spanned {
4567
- node: hir:: DeclKind :: Item ( item_id) ,
4568
- span: s. span,
4569
- } ) ,
4570
- id. take( )
4556
+ . map( |item_id| hir:: Stmt {
4557
+ id: id. take( )
4571
4558
. map( |id| self . lower_node_id( id) . node_id)
4572
4559
. unwrap_or_else( || self . next_id( ) . node_id) ,
4573
- ) ,
4560
+ node : hir :: StmtKind :: Item ( P ( item_id ) ) ,
4574
4561
span: s. span,
4575
4562
} )
4576
4563
. collect( ) ;
4577
4564
}
4578
- StmtKind :: Expr ( ref e) => Spanned {
4579
- node: hir:: StmtKind :: Expr ( P ( self . lower_expr( e) ) , self . lower_node_id( s. id) . node_id) ,
4565
+ StmtKind :: Expr ( ref e) => hir:: Stmt {
4566
+ id: self . lower_node_id( s. id) . node_id,
4567
+ node: hir:: StmtKind :: Expr ( P ( self . lower_expr( e) ) ) ,
4580
4568
span: s. span,
4581
4569
} ,
4582
- StmtKind :: Semi ( ref e) => Spanned {
4583
- node: hir:: StmtKind :: Semi ( P ( self . lower_expr( e) ) , self . lower_node_id( s. id) . node_id) ,
4570
+ StmtKind :: Semi ( ref e) => hir:: Stmt {
4571
+ id: self . lower_node_id( s. id) . node_id,
4572
+ node: hir:: StmtKind :: Semi ( P ( self . lower_expr( e) ) ) ,
4584
4573
span: s. span,
4585
4574
} ,
4586
4575
StmtKind :: Mac ( ..) => panic!( "Shouldn't exist here" ) ,
@@ -4795,7 +4784,7 @@ impl<'a> LoweringContext<'a> {
4795
4784
) -> hir:: Stmt {
4796
4785
let LoweredNodeId { node_id, hir_id } = self . next_id ( ) ;
4797
4786
4798
- let local = P ( hir:: Local {
4787
+ let local = hir:: Local {
4799
4788
pat,
4800
4789
ty : None ,
4801
4790
init : ex,
@@ -4804,9 +4793,12 @@ impl<'a> LoweringContext<'a> {
4804
4793
span : sp,
4805
4794
attrs : ThinVec :: new ( ) ,
4806
4795
source,
4807
- } ) ;
4808
- let decl = respan ( sp, hir:: DeclKind :: Local ( local) ) ;
4809
- respan ( sp, hir:: StmtKind :: Decl ( P ( decl) , self . next_id ( ) . node_id ) )
4796
+ } ;
4797
+ hir:: Stmt {
4798
+ id : self . next_id ( ) . node_id ,
4799
+ node : hir:: StmtKind :: Local ( P ( local) ) ,
4800
+ span : sp
4801
+ }
4810
4802
}
4811
4803
4812
4804
fn stmt_let (
0 commit comments