@@ -1957,7 +1957,7 @@ impl<'a> LoweringContext<'a> {
19571957 )
19581958 }
19591959
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 ] > ) {
19611961 let LoweredNodeId { node_id, hir_id } = self . lower_node_id ( l. id ) ;
19621962 let mut ids = SmallVec :: < [ hir:: ItemId ; 1 ] > :: new ( ) ;
19631963 if self . sess . features_untracked ( ) . impl_trait_in_bindings {
@@ -1967,7 +1967,7 @@ impl<'a> LoweringContext<'a> {
19671967 }
19681968 }
19691969 let parent_def_id = DefId :: local ( self . current_hir_id_owner . last ( ) . unwrap ( ) . 0 ) ;
1970- ( P ( hir:: Local {
1970+ ( hir:: Local {
19711971 id : node_id,
19721972 hir_id,
19731973 ty : l. ty
@@ -1984,7 +1984,7 @@ impl<'a> LoweringContext<'a> {
19841984 span : l. span ,
19851985 attrs : l. attrs . clone ( ) ,
19861986 source : hir:: LocalSource :: Normal ,
1987- } ) , ids)
1987+ } , ids)
19881988 }
19891989
19901990 fn lower_mutability ( & mut self , m : Mutability ) -> hir:: Mutability {
@@ -4331,10 +4331,11 @@ impl<'a> LoweringContext<'a> {
43314331 ThinVec :: new ( ) ,
43324332 ) )
43334333 } ;
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+ } ;
43384339
43394340 let next_expr = P ( self . expr_ident ( head_sp, next_ident, next_pat. id ) ) ;
43404341
@@ -4357,10 +4358,11 @@ impl<'a> LoweringContext<'a> {
43574358
43584359 let body_block = self . with_loop_scope ( e. id , |this| this. lower_block ( body, false ) ) ;
43594360 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+ } ;
43644366
43654367 let loop_block = P ( self . block_all (
43664368 e. span ,
@@ -4533,25 +4535,15 @@ impl<'a> LoweringContext<'a> {
45334535 let ( l, item_ids) = self . lower_local( l) ;
45344536 let mut ids: SmallVec <[ hir:: Stmt ; 1 ] > = item_ids
45354537 . 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) ) ,
45444541 span: s. span,
45454542 } )
45464543 . 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) ) ,
45554547 span: s. span,
45564548 } ) ;
45574549 return ids;
@@ -4561,26 +4553,23 @@ impl<'a> LoweringContext<'a> {
45614553 let mut id = Some ( s. id) ;
45624554 return self . lower_item_id( it)
45634555 . 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( )
45714558 . map( |id| self . lower_node_id( id) . node_id)
45724559 . unwrap_or_else( || self . next_id( ) . node_id) ,
4573- ) ,
4560+ node : hir :: StmtKind :: Item ( P ( item_id ) ) ,
45744561 span: s. span,
45754562 } )
45764563 . collect( ) ;
45774564 }
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) ) ) ,
45804568 span: s. span,
45814569 } ,
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) ) ) ,
45844573 span: s. span,
45854574 } ,
45864575 StmtKind :: Mac ( ..) => panic!( "Shouldn't exist here" ) ,
@@ -4795,7 +4784,7 @@ impl<'a> LoweringContext<'a> {
47954784 ) -> hir:: Stmt {
47964785 let LoweredNodeId { node_id, hir_id } = self . next_id ( ) ;
47974786
4798- let local = P ( hir:: Local {
4787+ let local = hir:: Local {
47994788 pat,
48004789 ty : None ,
48014790 init : ex,
@@ -4804,9 +4793,12 @@ impl<'a> LoweringContext<'a> {
48044793 span : sp,
48054794 attrs : ThinVec :: new ( ) ,
48064795 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+ }
48104802 }
48114803
48124804 fn stmt_let (
0 commit comments