Skip to content

Commit

Permalink
Give variant spans used in derives the correct expansion id
Browse files Browse the repository at this point in the history
This fixes a problem in save-analysis where it mistakes a path to a variant as the variant itself.
  • Loading branch information
nrc committed Oct 27, 2016
1 parent 0743694 commit 16e1d36
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/librustc_save_analysis/dump_visitor.rs
Expand Up @@ -166,6 +166,7 @@ impl<'l, 'tcx: 'l, 'll, D: Dump + 'll> DumpVisitor<'l, 'tcx, 'll, D> {
loc.file.name,
loc.line);
}
error!(" master span: {:?}: `{}`", path.span, self.span.snippet(path.span));
return vec!();
}

Expand Down
3 changes: 2 additions & 1 deletion src/libsyntax_ext/deriving/generic/mod.rs
Expand Up @@ -1460,8 +1460,9 @@ impl<'a> MethodDef<'a> {
.iter()
.map(|v| {
let ident = v.node.name;
let sp = Span { expn_id: trait_.span.expn_id, ..v.span };
let summary = trait_.summarise_struct(cx, &v.node.data);
(ident, v.span, summary)
(ident, sp, summary)
})
.collect();
self.call_substructure_method(cx,
Expand Down

0 comments on commit 16e1d36

Please sign in to comment.