diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2017-03-10 16:51:28 -0600 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2017-03-10 16:18:28 -0800 |
| commit | 755877dbfd11c4819a22516b2f84b1692333f968 (patch) | |
| tree | a27c08a5dc1afc055e605945f9c9be7f19994396 /src/libsyntax | |
| parent | ac1bbf7cee16cad9dfe758d2a2399e6c16733a7c (diff) | |
| parent | 5afe784daae5782389b97f0ec1317193433ba9a2 (diff) | |
| download | rust-755877dbfd11c4819a22516b2f84b1692333f968.tar.gz rust-755877dbfd11c4819a22516b2f84b1692333f968.zip | |
Rollup merge of #40311 - nrc:save-proc-macro-attr, r=jseyfried
Expect macro defs in save-analysis and add expn info to spans for att… …r proc macros r? @jseyfried
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/ext/expand.rs | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index f1662284a88..f7dcd00e409 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -464,8 +464,20 @@ impl<'a, 'b> MacroExpander<'a, 'b> { let attr_toks = stream_for_attr_args(&attr, &self.cx.parse_sess); let item_toks = stream_for_item(&item, &self.cx.parse_sess); + let span = Span { + expn_id: self.cx.codemap().record_expansion(ExpnInfo { + call_site: attr.span, + callee: NameAndSpan { + format: MacroAttribute(name), + span: None, + allow_internal_unstable: false, + }, + }), + ..attr.span + }; + let tok_result = mac.expand(self.cx, attr.span, attr_toks, item_toks); - self.parse_expansion(tok_result, kind, name, attr.span) + self.parse_expansion(tok_result, kind, name, span) } SyntaxExtension::ProcMacroDerive(..) | SyntaxExtension::BuiltinDerive(..) => { self.cx.span_err(attr.span, &format!("`{}` is a derive mode", name)); |
