about summary refs log tree commit diff
path: root/src/libsyntax_ext
diff options
context:
space:
mode:
authorJosh Driver <keeperofdakeys@gmail.com>2016-11-08 23:03:33 +1030
committerJosh Driver <keeperofdakeys@gmail.com>2016-11-08 23:03:56 +1030
commit134ef4f7933b87efdc04eac3e8d9a530d56d9cfe (patch)
treecc06523b6156b87e13ea8e57c4aff813396cc4be /src/libsyntax_ext
parent31a508e1185713c6e570bb963dd3e097a228957c (diff)
downloadrust-134ef4f7933b87efdc04eac3e8d9a530d56d9cfe.tar.gz
rust-134ef4f7933b87efdc04eac3e8d9a530d56d9cfe.zip
Revert "Point macros 1.1 errors to the input item"
This reverts commit 3784067edcbcd0614f6c4c88f6445ca17ae27ff6.
Any errors in the derived output now point at the derive attribute
instead of the item.
Diffstat (limited to 'src/libsyntax_ext')
-rw-r--r--src/libsyntax_ext/deriving/custom.rs20
1 files changed, 3 insertions, 17 deletions
diff --git a/src/libsyntax_ext/deriving/custom.rs b/src/libsyntax_ext/deriving/custom.rs
index 2b80deded0a..3305c1eae2b 100644
--- a/src/libsyntax_ext/deriving/custom.rs
+++ b/src/libsyntax_ext/deriving/custom.rs
@@ -14,12 +14,10 @@ use errors::FatalError;
 use proc_macro::{TokenStream, __internal};
 use syntax::ast::{self, ItemKind, Attribute};
 use syntax::attr::{mark_used, mark_known};
-use syntax::codemap::{ExpnInfo, MacroAttribute, NameAndSpan, Span};
+use syntax::codemap::Span;
 use syntax::ext::base::*;
 use syntax::fold::Folder;
 use syntax::parse::token::InternedString;
-use syntax::parse::token::intern;
-use syntax::print::pprust;
 use syntax::visit::Visitor;
 
 struct MarkAttrs<'a>(&'a [InternedString]);
@@ -50,7 +48,7 @@ impl MultiItemModifier for CustomDerive {
     fn expand(&self,
               ecx: &mut ExtCtxt,
               span: Span,
-              meta_item: &ast::MetaItem,
+              _meta_item: &ast::MetaItem,
               item: Annotatable)
               -> Vec<Annotatable> {
         let item = match item {
@@ -75,18 +73,6 @@ impl MultiItemModifier for CustomDerive {
         // Mark attributes as known, and used.
         MarkAttrs(&self.attrs).visit_item(&item);
 
-        let input_span = Span {
-            expn_id: ecx.codemap().record_expansion(ExpnInfo {
-                call_site: span,
-                callee: NameAndSpan {
-                    format: MacroAttribute(intern(&pprust::meta_item_to_string(meta_item))),
-                    span: Some(span),
-                    allow_internal_unstable: true,
-                },
-            }),
-            ..item.span
-        };
-
         let input = __internal::new_token_stream(item.clone());
         let res = __internal::set_parse_sess(&ecx.parse_sess, || {
             let inner = self.inner;
@@ -113,7 +99,7 @@ impl MultiItemModifier for CustomDerive {
         // Reassign spans of all expanded items to the input `item`
         // for better errors here.
         res.extend(new_items.into_iter().flat_map(|item| {
-            ChangeSpan { span: input_span }.fold_item(item)
+            ChangeSpan { span: span }.fold_item(item)
         }).map(Annotatable::Item));
         res
     }