@@ -356,6 +356,7 @@ impl<'a, 'ra, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'ra, 'tcx> {
356356 let kind = match self . impl_trait_context {
357357 ImplTraitContext :: Universal => DefKind :: TyParam ,
358358 ImplTraitContext :: Existential => DefKind :: OpaqueTy ,
359+ ImplTraitContext :: InBinding => return visit:: walk_ty ( self , ty) ,
359360 } ;
360361 let id = self . create_def ( * id, name, kind, ty. span ) ;
361362 match self . impl_trait_context {
@@ -365,6 +366,7 @@ impl<'a, 'ra, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'ra, 'tcx> {
365366 ImplTraitContext :: Existential => {
366367 self . with_parent ( id, |this| visit:: walk_ty ( this, ty) )
367368 }
369+ ImplTraitContext :: InBinding => unreachable ! ( ) ,
368370 } ;
369371 }
370372 _ => visit:: walk_ty ( self , ty) ,
@@ -374,6 +376,13 @@ impl<'a, 'ra, 'tcx> visit::Visitor<'a> for DefCollector<'a, 'ra, 'tcx> {
374376 fn visit_stmt ( & mut self , stmt : & ' a Stmt ) {
375377 match stmt. kind {
376378 StmtKind :: MacCall ( ..) => self . visit_macro_invoc ( stmt. id ) ,
379+ // FIXME(impl_trait_in_bindings): We don't really have a good way of
380+ // introducing the right `ImplTraitContext` here for all the cases we
381+ // care about, in case we want to introduce ITIB to other positions
382+ // such as turbofishes (e.g. `foo::<impl Fn()>(|| {})`).
383+ StmtKind :: Let ( ref local) => self . with_impl_trait ( ImplTraitContext :: InBinding , |this| {
384+ visit:: walk_local ( this, local)
385+ } ) ,
377386 _ => visit:: walk_stmt ( self , stmt) ,
378387 }
379388 }
0 commit comments