@@ -77,6 +77,7 @@ impl<'a> DefCollector<'a> {
7777 & mut self ,
7878 id : NodeId ,
7979 async_node_id : NodeId ,
80+ return_impl_trait_id : NodeId ,
8081 name : Name ,
8182 span : Span ,
8283 visit_fn : impl FnOnce ( & mut DefCollector < ' a > )
@@ -86,6 +87,7 @@ impl<'a> DefCollector<'a> {
8687 let fn_def_data = DefPathData :: ValueNs ( name. as_interned_str ( ) ) ;
8788 let fn_def = self . create_def ( id, fn_def_data, ITEM_LIKE_SPACE , span) ;
8889 return self . with_parent ( fn_def, |this| {
90+ this. create_def ( return_impl_trait_id, DefPathData :: ImplTrait , REGULAR_SPACE , span) ;
8991 let closure_def = this. create_def ( async_node_id,
9092 DefPathData :: ClosureExpr ,
9193 REGULAR_SPACE ,
@@ -120,10 +122,14 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
120122 ItemKind :: Mod ( ..) if i. ident == keywords:: Invalid . ident ( ) => {
121123 return visit:: walk_item ( self , i) ;
122124 }
123- ItemKind :: Fn ( _, FnHeader { asyncness : IsAsync :: Async ( async_node_id) , .. } , ..) => {
125+ ItemKind :: Fn ( _, FnHeader { asyncness : IsAsync :: Async {
126+ closure_id,
127+ return_impl_trait_id,
128+ } , .. } , ..) => {
124129 return self . visit_async_fn (
125130 i. id ,
126- async_node_id,
131+ closure_id,
132+ return_impl_trait_id,
127133 i. ident . name ,
128134 i. span ,
129135 |this| visit:: walk_item ( this, i)
@@ -227,11 +233,15 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
227233 fn visit_impl_item ( & mut self , ii : & ' a ImplItem ) {
228234 let def_data = match ii. node {
229235 ImplItemKind :: Method ( MethodSig {
230- header : FnHeader { asyncness : IsAsync :: Async ( async_node_id) , .. } , ..
236+ header : FnHeader { asyncness : IsAsync :: Async {
237+ closure_id,
238+ return_impl_trait_id,
239+ } , .. } , ..
231240 } , ..) => {
232241 return self . visit_async_fn (
233242 ii. id ,
234- async_node_id,
243+ closure_id,
244+ return_impl_trait_id,
235245 ii. ident . name ,
236246 ii. span ,
237247 |this| visit:: walk_impl_item ( this, ii)
@@ -276,8 +286,8 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
276286
277287 // Async closures desugar to closures inside of closures, so
278288 // we must create two defs.
279- if let IsAsync :: Async ( async_id ) = asyncness {
280- let async_def = self . create_def ( async_id ,
289+ if let IsAsync :: Async { closure_id , .. } = asyncness {
290+ let async_def = self . create_def ( closure_id ,
281291 DefPathData :: ClosureExpr ,
282292 REGULAR_SPACE ,
283293 expr. span ) ;
@@ -301,6 +311,9 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
301311 fn visit_ty ( & mut self , ty : & ' a Ty ) {
302312 match ty. node {
303313 TyKind :: Mac ( ..) => return self . visit_macro_invoc ( ty. id ) ,
314+ TyKind :: ImplTrait ( node_id, _) => {
315+ self . create_def ( node_id, DefPathData :: ImplTrait , REGULAR_SPACE , ty. span ) ;
316+ }
304317 _ => { }
305318 }
306319 visit:: walk_ty ( self , ty) ;
0 commit comments