summary refs log tree commit diff
path: root/src/libsyntax_ext
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-11-10 11:25:17 -0800
committerGitHub <noreply@github.com>2016-11-10 11:25:17 -0800
commit3dced6f71e6e8cf8f59e3614194a61427a3a408b (patch)
treed774bf9b6a1fda191695d4917979b0243652812d /src/libsyntax_ext
parentbc1cc1db6ddee8d57d20adc05b740e3b73649ab5 (diff)
parent67eeb0a72081ae7db45a07de55fd2cb77b2ebee1 (diff)
downloadrust-3dced6f71e6e8cf8f59e3614194a61427a3a408b.tar.gz
rust-3dced6f71e6e8cf8f59e3614194a61427a3a408b.zip
Auto merge of #37645 - jseyfried:fix_crate_var_in_custom_derives, r=nrc
Fix regression involving custom derives on items with `$crate`

The regression was introduced in #37213.

I believe we cannot make the improvements from #37213 work with the current custom derive setup (c.f. https://github.com/rust-lang/rust/issues/37637#issuecomment-258959145) -- we'll have to wait for `TokenStream`'s API to improve.

Fixes #37637.
r? @nrc
Diffstat (limited to 'src/libsyntax_ext')
-rw-r--r--src/libsyntax_ext/deriving/custom.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libsyntax_ext/deriving/custom.rs b/src/libsyntax_ext/deriving/custom.rs
index 3305c1eae2b..e101757ad23 100644
--- a/src/libsyntax_ext/deriving/custom.rs
+++ b/src/libsyntax_ext/deriving/custom.rs
@@ -73,7 +73,7 @@ impl MultiItemModifier for CustomDerive {
         // Mark attributes as known, and used.
         MarkAttrs(&self.attrs).visit_item(&item);
 
-        let input = __internal::new_token_stream(item.clone());
+        let input = __internal::new_token_stream(ecx.resolver.eliminate_crate_var(item.clone()));
         let res = __internal::set_parse_sess(&ecx.parse_sess, || {
             let inner = self.inner;
             panic::catch_unwind(panic::AssertUnwindSafe(|| inner(input)))