Skip to content

Commit

Permalink
Adding type paramter ribs for generic associated types
Browse files Browse the repository at this point in the history
  • Loading branch information
sunjay committed Dec 1, 2017
1 parent 4a69ce9 commit e0621a1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/librustc_resolve/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
});
}
Expand Down Expand Up @@ -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!"),
Expand Down

0 comments on commit e0621a1

Please sign in to comment.