Skip to content

Commit 156a55e

Browse files
authored
Rollup merge of #65511 - Xanewok:sa-nest-in-impls, r=pnkfelix
save-analysis: Nest tables when processing impl block definitions Similar to #65353 (which this PR should've been a part of), however in this case we didn't previously nest the tables when processing trait paths in impl block declarations. Closes #65411
2 parents 9fc8d8e + ad6ce46 commit 156a55e

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

src/librustc_save_analysis/dump_visitor.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -669,15 +669,18 @@ impl<'l, 'tcx> DumpVisitor<'l, 'tcx> {
669669
}
670670
}
671671
}
672-
self.visit_ty(&typ);
673-
if let &Some(ref trait_ref) = trait_ref {
674-
self.process_path(trait_ref.ref_id, &trait_ref.path);
675-
}
676-
self.process_generic_params(generics, "", item.id);
677-
for impl_item in impl_items {
678-
let map = &self.tcx.hir();
679-
self.process_impl_item(impl_item, map.local_def_id_from_node_id(item.id));
680-
}
672+
673+
let map = &self.tcx.hir();
674+
self.nest_tables(item.id, |v| {
675+
v.visit_ty(&typ);
676+
if let &Some(ref trait_ref) = trait_ref {
677+
v.process_path(trait_ref.ref_id, &trait_ref.path);
678+
}
679+
v.process_generic_params(generics, "", item.id);
680+
for impl_item in impl_items {
681+
v.process_impl_item(impl_item, map.local_def_id_from_node_id(item.id));
682+
}
683+
});
681684
}
682685

683686
fn process_trait(
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// check-pass
2+
// compile-flags: -Zsave-analysis
3+
4+
trait Trait { type Assoc; }
5+
trait GenericTrait<T> {}
6+
struct Wrapper<B> { b: B }
7+
8+
fn func() {
9+
// Processing associated path in impl block definition inside a function
10+
// body does not ICE
11+
impl<B: Trait> GenericTrait<B::Assoc> for Wrapper<B> {}
12+
}
13+
14+
15+
fn main() {}

0 commit comments

Comments
 (0)