@@ -438,31 +438,6 @@ impl<'a> TokenStreamLowering<'a> {
438438    } 
439439} 
440440
441- struct  ImplTraitTypeIdVisitor < ' a >  { 
442-     ids :  & ' a  mut  SmallVec < [ NodeId ;  1 ] > , 
443- } 
444- 
445- impl  Visitor < ' _ >  for  ImplTraitTypeIdVisitor < ' _ >  { 
446-     fn  visit_ty ( & mut  self ,  ty :  & Ty )  { 
447-         match  ty. kind  { 
448-             TyKind :: Typeof ( _)  | TyKind :: BareFn ( _)  => return , 
449- 
450-             TyKind :: ImplTrait ( id,  _)  => self . ids . push ( id) , 
451-             _ => { } 
452-         } 
453-         visit:: walk_ty ( self ,  ty) ; 
454-     } 
455- 
456-     fn  visit_path_segment ( & mut  self ,  path_span :  Span ,  path_segment :  & PathSegment )  { 
457-         if  let  Some ( ref  p)  = path_segment. args  { 
458-             if  let  GenericArgs :: Parenthesized ( _)  = * * p { 
459-                 return ; 
460-             } 
461-         } 
462-         visit:: walk_path_segment ( self ,  path_span,  path_segment) 
463-     } 
464- } 
465- 
466441impl < ' a ,  ' hir >  LoweringContext < ' a ,  ' hir >  { 
467442    fn  lower_crate ( mut  self ,  c :  & Crate )  -> hir:: Crate < ' hir >  { 
468443        /// Full-crate AST visitor that inserts into a fresh 
@@ -1789,14 +1764,7 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
17891764        ) 
17901765    } 
17911766
1792-     fn  lower_local ( & mut  self ,  l :  & Local )  -> ( hir:: Local < ' hir > ,  SmallVec < [ NodeId ;  1 ] > )  { 
1793-         let  mut  ids = SmallVec :: < [ NodeId ;  1 ] > :: new ( ) ; 
1794-         if  self . sess . features_untracked ( ) . impl_trait_in_bindings  { 
1795-             if  let  Some ( ref  ty)  = l. ty  { 
1796-                 let  mut  visitor = ImplTraitTypeIdVisitor  {  ids :  & mut  ids } ; 
1797-                 visitor. visit_ty ( ty) ; 
1798-             } 
1799-         } 
1767+     fn  lower_local ( & mut  self ,  l :  & Local )  -> hir:: Local < ' hir >  { 
18001768        let  ty = l. ty . as_ref ( ) . map ( |t| { 
18011769            let  mut  capturable_lifetimes; 
18021770            self . lower_ty ( 
@@ -1815,17 +1783,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
18151783        let  init = l. init . as_ref ( ) . map ( |e| self . lower_expr ( e) ) ; 
18161784        let  hir_id = self . lower_node_id ( l. id ) ; 
18171785        self . lower_attrs ( hir_id,  & l. attrs ) ; 
1818-         ( 
1819-             hir:: Local  { 
1820-                 hir_id, 
1821-                 ty, 
1822-                 pat :  self . lower_pat ( & l. pat ) , 
1823-                 init, 
1824-                 span :  l. span , 
1825-                 source :  hir:: LocalSource :: Normal , 
1826-             } , 
1827-             ids, 
1828-         ) 
1786+         hir:: Local  { 
1787+             hir_id, 
1788+             ty, 
1789+             pat :  self . lower_pat ( & l. pat ) , 
1790+             init, 
1791+             span :  l. span , 
1792+             source :  hir:: LocalSource :: Normal , 
1793+         } 
18291794    } 
18301795
18311796    fn  lower_fn_params_to_names ( & mut  self ,  decl :  & FnDecl )  -> & ' hir  [ Ident ]  { 
@@ -2445,27 +2410,14 @@ impl<'a, 'hir> LoweringContext<'a, 'hir> {
24452410    fn  lower_stmt ( & mut  self ,  s :  & Stmt )  -> SmallVec < [ hir:: Stmt < ' hir > ;  1 ] >  { 
24462411        let  ( hir_id,  kind)  = match  s. kind  { 
24472412            StmtKind :: Local ( ref  l)  => { 
2448-                 let  ( l,  item_ids)  = self . lower_local ( l) ; 
2449-                 let  mut  ids:  SmallVec < [ hir:: Stmt < ' hir > ;  1 ] >  = item_ids
2450-                     . into_iter ( ) 
2451-                     . map ( |item_id| { 
2452-                         let  item_id = hir:: ItemId  { 
2453-                             // All the items that `lower_local` finds are `impl Trait` types. 
2454-                             def_id :  self . lower_node_id ( item_id) . expect_owner ( ) , 
2455-                         } ; 
2456-                         self . stmt ( s. span ,  hir:: StmtKind :: Item ( item_id) ) 
2457-                     } ) 
2458-                     . collect ( ) ; 
2413+                 let  l = self . lower_local ( l) ; 
24592414                let  hir_id = self . lower_node_id ( s. id ) ; 
24602415                self . alias_attrs ( hir_id,  l. hir_id ) ; 
2461-                 ids. push ( { 
2462-                     hir:: Stmt  { 
2463-                         hir_id, 
2464-                         kind :  hir:: StmtKind :: Local ( self . arena . alloc ( l) ) , 
2465-                         span :  s. span , 
2466-                     } 
2467-                 } ) ; 
2468-                 return  ids; 
2416+                 return  smallvec ! [ hir:: Stmt  { 
2417+                     hir_id, 
2418+                     kind:  hir:: StmtKind :: Local ( self . arena. alloc( l) ) , 
2419+                     span:  s. span, 
2420+                 } ] ; 
24692421            } 
24702422            StmtKind :: Item ( ref  it)  => { 
24712423                // Can only use the ID once. 
0 commit comments