From e0621a178613d04bcd3855dd74bf0a3affb105df Mon Sep 17 00:00:00 2001 From: Sunjay Varma Date: Tue, 21 Nov 2017 01:46:55 -0500 Subject: [PATCH] Adding type paramter ribs for generic associated types --- src/librustc_resolve/lib.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/librustc_resolve/lib.rs b/src/librustc_resolve/lib.rs index 44db030b2b2..42eac5e4949 100644 --- a/src/librustc_resolve/lib.rs +++ b/src/librustc_resolve/lib.rs @@ -1910,7 +1910,9 @@ impl<'a> Resolver<'a> { }); } TraitItemKind::Type(..) => { - this.with_type_parameter_rib(NoTypeParameters, |this| { + let type_parameters = HasTypeParameters(&trait_item.generics, + ItemRibKind); + this.with_type_parameter_rib(type_parameters, |this| { visit::walk_trait_item(this, trait_item) }); } @@ -2160,7 +2162,13 @@ impl<'a> Resolver<'a> { impl_item.span, |n, s| ResolutionError::TypeNotMemberOfTrait(n, s)); - this.visit_ty(ty); + // We also need a new scope for the associated type + // specific type parameters. + let type_parameters = + HasTypeParameters(&impl_item.generics, ItemRibKind); + this.with_type_parameter_rib(type_parameters, |this| { + this.visit_ty(ty); + }); } ImplItemKind::Macro(_) => panic!("unexpanded macro in resolve!"),