diff options
| author | Nick Cameron <ncameron@mozilla.com> | 2016-10-28 10:49:45 +1300 |
|---|---|---|
| committer | Nick Cameron <ncameron@mozilla.com> | 2016-10-28 10:49:45 +1300 |
| commit | 16e1d36c0851b6cb47a215a8fe94178fd39eab04 (patch) | |
| tree | 46382f68acd89f055da626f0d7da157176a2ffe0 | |
| parent | 07436946b6ee6345509b73c6e4dafb38b6a243f1 (diff) | |
| download | rust-16e1d36c0851b6cb47a215a8fe94178fd39eab04.tar.gz rust-16e1d36c0851b6cb47a215a8fe94178fd39eab04.zip | |
Give variant spans used in derives the correct expansion id
This fixes a problem in save-analysis where it mistakes a path to a variant as the variant itself.
| -rw-r--r-- | src/librustc_save_analysis/dump_visitor.rs | 1 | ||||
| -rw-r--r-- | src/libsyntax_ext/deriving/generic/mod.rs | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/src/librustc_save_analysis/dump_visitor.rs b/src/librustc_save_analysis/dump_visitor.rs index 1c60ccb9765..47d5a1e36b1 100644 --- a/src/librustc_save_analysis/dump_visitor.rs +++ b/src/librustc_save_analysis/dump_visitor.rs @@ -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!(); } diff --git a/src/libsyntax_ext/deriving/generic/mod.rs b/src/libsyntax_ext/deriving/generic/mod.rs index bc47d8f4e61..687f8c902f2 100644 --- a/src/libsyntax_ext/deriving/generic/mod.rs +++ b/src/libsyntax_ext/deriving/generic/mod.rs @@ -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, |
