@@ -1788,14 +1788,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17881788 )
17891789 }
17901790
1791- fn lower_local ( & mut self , l : & Local ) -> ( hir:: Local < ' hir > , SmallVec < [ NodeId ; 1 ] > ) {
1792- let mut ids = SmallVec :: < [ NodeId ; 1 ] > :: new ( ) ;
1793- if self . sess . features_untracked ( ) . impl_trait_in_bindings {
1794- if let Some ( ref ty) = l. ty {
1795- let mut visitor = ImplTraitTypeIdVisitor { ids : & mut ids } ;
1796- visitor. visit_ty ( ty) ;
1797- }
1798- }
1791+ fn lower_local ( & mut self , l : & Local ) -> hir:: Local < ' hir > {
17991792 let ty = l. ty . as_ref ( ) . map ( |t| {
18001793 let mut capturable_lifetimes;
18011794 self . lower_ty (
@@ -1814,17 +1807,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
18141807 let init = l. init . as_ref ( ) . map ( |e| self . lower_expr ( e) ) ;
18151808 let hir_id = self . lower_node_id ( l. id ) ;
18161809 self . lower_attrs ( hir_id, & l. attrs ) ;
1817- (
1818- hir:: Local {
1819- hir_id,
1820- ty,
1821- pat : self . lower_pat ( & l. pat ) ,
1822- init,
1823- span : l. span ,
1824- source : hir:: LocalSource :: Normal ,
1825- } ,
1826- ids,
1827- )
1810+ hir:: Local {
1811+ hir_id,
1812+ ty,
1813+ pat : self . lower_pat ( & l. pat ) ,
1814+ init,
1815+ span : l. span ,
1816+ source : hir:: LocalSource :: Normal ,
1817+ }
18281818 }
18291819
18301820 fn lower_fn_params_to_names ( & mut self , decl : & FnDecl ) -> & ' hir [ Ident ] {
@@ -2438,27 +2428,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24382428 fn lower_stmt ( & mut self , s : & Stmt ) -> SmallVec < [ hir:: Stmt < ' hir > ; 1 ] > {
24392429 let ( hir_id, kind) = match s. kind {
24402430 StmtKind :: Local ( ref l) => {
2441- let ( l, item_ids) = self . lower_local ( l) ;
2442- let mut ids: SmallVec < [ hir:: Stmt < ' hir > ; 1 ] > = item_ids
2443- . into_iter ( )
2444- . map ( |item_id| {
2445- let item_id = hir:: ItemId {
2446- // All the items that `lower_local` finds are `impl Trait` types.
2447- def_id : self . lower_node_id ( item_id) . expect_owner ( ) ,
2448- } ;
2449- self . stmt ( s. span , hir:: StmtKind :: Item ( item_id) )
2450- } )
2451- . collect ( ) ;
2431+ let l = self . lower_local ( l) ;
24522432 let hir_id = self . lower_node_id ( s. id ) ;
24532433 self . alias_attrs ( hir_id, l. hir_id ) ;
2454- ids. push ( {
2455- hir:: Stmt {
2456- hir_id,
2457- kind : hir:: StmtKind :: Local ( self . arena . alloc ( l) ) ,
2458- span : s. span ,
2459- }
2460- } ) ;
2461- return ids;
2434+ return smallvec ! [ hir:: Stmt {
2435+ hir_id,
2436+ kind: hir:: StmtKind :: Local ( self . arena. alloc( l) ) ,
2437+ span: s. span,
2438+ } ] ;
24622439 }
24632440 StmtKind :: Item ( ref it) => {
24642441 // Can only use the ID once.
0 commit comments