Skip to content

Commit d4b063d

Browse files
committed
Auto merge of #38952 - nrc:save-impl-fix, r=eddyb
save-analysis: handle paths in type/trait context more correctly TBH, this is still not perfect, witness the FIXME, but it is an improvement. In particular it means we get information about trait references in impls.
2 parents ef04fc8 + 745a5e8 commit d4b063d

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/librustc_save_analysis/dump_visitor.rs

+6-8
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,8 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
470470
if !self.span.filter_generated(Some(trait_ref_data.span), trait_ref.path.span) {
471471
self.dumper.type_ref(trait_ref_data.lower(self.tcx));
472472
}
473-
474-
visit::walk_path(self, &trait_ref.path);
475473
}
474+
self.process_path(trait_ref.ref_id, &trait_ref.path, Some(recorder::TypeRef));
476475
}
477476

478477
fn process_struct_field_def(&mut self, field: &ast::StructField, parent_id: NodeId) {
@@ -756,8 +755,6 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
756755
if !self.span.filter_generated(Some(trait_ref_data.span), item.span) {
757756
self.dumper.type_ref(trait_ref_data.clone().lower(self.tcx));
758757
}
759-
760-
visit::walk_path(self, &trait_ref.as_ref().unwrap().path);
761758
}
762759

763760
if !self.span.filter_generated(Some(impl_data.span), item.span) {
@@ -773,6 +770,9 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
773770
if !has_self_ref {
774771
self.visit_ty(&typ);
775772
}
773+
if let &Some(ref trait_ref) = trait_ref {
774+
self.process_path(trait_ref.ref_id, &trait_ref.path, Some(recorder::TypeRef));
775+
}
776776
self.process_generic_params(type_parameters, item.span, "", item.id);
777777
for impl_item in impl_items {
778778
let map = &self.tcx.map;
@@ -1001,8 +1001,8 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
10011001

10021002
fn process_pat(&mut self, p: &'l ast::Pat) {
10031003
match p.node {
1004-
PatKind::Struct(ref path, ref fields, _) => {
1005-
visit::walk_path(self, path);
1004+
PatKind::Struct(ref _path, ref fields, _) => {
1005+
// FIXME do something with _path?
10061006
let adt = match self.save_ctxt.tables.node_id_to_type_opt(p.id) {
10071007
Some(ty) => ty.ty_adt_def().unwrap(),
10081008
None => {
@@ -1359,8 +1359,6 @@ impl<'l, 'tcx: 'l, 'll, D: Dump +'ll> Visitor<'l> for DumpVisitor<'l, 'tcx, 'll,
13591359
}
13601360

13611361
self.write_sub_paths_truncated(path);
1362-
1363-
visit::walk_path(self, path);
13641362
}
13651363
ast::TyKind::Array(ref element, ref length) => {
13661364
self.visit_ty(element);

0 commit comments

Comments
 (0)