diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-08-20 23:35:03 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-08-27 01:34:10 +0300 |
| commit | c476b55e528ce854b6198de5bcfdd20b08440c9d (patch) | |
| tree | d59e39ff632190cda0426a7cde8ac3658a9c641e /src/libsyntax/ext | |
| parent | 2065ee9accc87a461897d06414195cfa3e92fb89 (diff) | |
| download | rust-c476b55e528ce854b6198de5bcfdd20b08440c9d.tar.gz rust-c476b55e528ce854b6198de5bcfdd20b08440c9d.zip | |
proc_macro: Update `Span::def_site` to use the proc macro definition location
Which is no longer dummy and is available from metadata now.
Diffstat (limited to 'src/libsyntax/ext')
| -rw-r--r-- | src/libsyntax/ext/proc_macro_server.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsyntax/ext/proc_macro_server.rs b/src/libsyntax/ext/proc_macro_server.rs index b1bbd2aaac9..1a26b17dac7 100644 --- a/src/libsyntax/ext/proc_macro_server.rs +++ b/src/libsyntax/ext/proc_macro_server.rs @@ -360,12 +360,11 @@ pub(crate) struct Rustc<'a> { impl<'a> Rustc<'a> { pub fn new(cx: &'a ExtCtxt<'_>) -> Self { - // No way to determine def location for a proc macro right now, so use call location. - let location = cx.current_expansion.id.expn_data().call_site; + let expn_data = cx.current_expansion.id.expn_data(); Rustc { sess: cx.parse_sess, - def_site: cx.with_def_site_ctxt(location), - call_site: cx.with_call_site_ctxt(location), + def_site: cx.with_def_site_ctxt(expn_data.def_site), + call_site: cx.with_call_site_ctxt(expn_data.call_site), } } |
