From d908e97da34ecc419024ddcf5004033920ebb9a9 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Tue, 21 Jan 2014 23:09:53 -0800 Subject: Redo exported macro serialization The old method of serializing the AST gives totally bogus spans if the expansion of an imported macro causes compilation errors. The best solution seems to be to serialize the actual textual macro definition and load it the same way the std-macros are. I'm not totally confident that getting the source from the CodeMap will always do the right thing, but it seems to work in simple cases. --- src/libsyntax/parse/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libsyntax/parse') diff --git a/src/libsyntax/parse/mod.rs b/src/libsyntax/parse/mod.rs index 9713f331147..e026a11cafe 100644 --- a/src/libsyntax/parse/mod.rs +++ b/src/libsyntax/parse/mod.rs @@ -130,10 +130,10 @@ pub fn parse_item_from_source_str( name: @str, source: @str, cfg: ast::CrateConfig, - attrs: ~[ast::Attribute], sess: @ParseSess ) -> Option<@ast::Item> { let mut p = new_parser_from_source_str(sess, cfg, name, source); + let attrs = p.parse_outer_attributes(); maybe_aborted(p.parse_item(attrs),p) } -- cgit 1.4.1-3-g733a5