Compute all_traits_impls during resolution.

This commit is contained in:
Camille GILLOT
2021-07-16 21:55:10 +02:00
parent 26eeec0baf
commit 635978041d
8 changed files with 17 additions and 18 deletions

View File

@@ -1281,7 +1281,14 @@ impl<'a: 'ast, 'b, 'ast> LateResolutionVisitor<'a, 'b, 'ast> {
this.with_self_rib(Res::SelfTy(None, None), |this| {
// Resolve the trait reference, if necessary.
this.with_optional_trait_ref(opt_trait_reference.as_ref(), |this, trait_id| {
let item_def_id = this.r.local_def_id(item_id).to_def_id();
let item_def_id = this.r.local_def_id(item_id);
// Register the trait definitions from here.
if let Some(trait_id) = trait_id {
this.r.trait_impls.entry(trait_id).or_default().push(item_def_id);
}
let item_def_id = item_def_id.to_def_id();
this.with_self_rib(Res::SelfTy(trait_id, Some((item_def_id, false))), |this| {
if let Some(trait_ref) = opt_trait_reference.as_ref() {
// Resolve type arguments in the trait path.