Skip to content

save-analysis: handle paths in type/trait context more correctly #38952

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/librustc_save_analysis/dump_visitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -470,9 +470,8 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
if !self.span.filter_generated(Some(trait_ref_data.span), trait_ref.path.span) {
self.dumper.type_ref(trait_ref_data.lower(self.tcx));
}

visit::walk_path(self, &trait_ref.path);
}
self.process_path(trait_ref.ref_id, &trait_ref.path, Some(recorder::TypeRef));
}

fn process_struct_field_def(&mut self, field: &ast::StructField, parent_id: NodeId) {
Expand Down Expand Up @@ -756,8 +755,6 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
if !self.span.filter_generated(Some(trait_ref_data.span), item.span) {
self.dumper.type_ref(trait_ref_data.clone().lower(self.tcx));
}

visit::walk_path(self, &trait_ref.as_ref().unwrap().path);
}

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

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

self.write_sub_paths_truncated(path);

visit::walk_path(self, path);
}
ast::TyKind::Array(ref element, ref length) => {
self.visit_ty(element);
Expand Down