Auto merge of #77546 - lcnr:impl-trait-closure, r=eddyb

fix def collector for impl trait

fixes #77329

We now consistently make `impl Trait` a hir owner, requiring some special casing for synthetic generic params.

r? `@eddyb`
This commit is contained in:
bors 2020-10-25 07:03:58 +00:00
commit 3e0dd24a6c
9 changed files with 98 additions and 19 deletions

View file

@ -240,13 +240,13 @@ impl<'a, 'b> visit::Visitor<'a> for DefCollector<'a, 'b> {
fn visit_ty(&mut self, ty: &'a Ty) {
match ty.kind {
TyKind::MacCall(..) => return self.visit_macro_invoc(ty.id),
TyKind::MacCall(..) => self.visit_macro_invoc(ty.id),
TyKind::ImplTrait(node_id, _) => {
self.create_def(node_id, DefPathData::ImplTrait, ty.span);
let parent_def = self.create_def(node_id, DefPathData::ImplTrait, ty.span);
self.with_parent(parent_def, |this| visit::walk_ty(this, ty));
}
_ => {}
_ => visit::walk_ty(self, ty),
}
visit::walk_ty(self, ty);
}
fn visit_stmt(&mut self, stmt: &'a Stmt) {