Skip to content

Redo exported macro serialization #11720

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 24, 2014
Merged

Conversation

sfackler
Copy link
Member

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.

@alexcrichton
Copy link
Member

This seems reasonable to me (source serialization), would it be possible to add tests for this?

@sfackler
Copy link
Member Author

We could add some run-test tests with nontrivial macros. Some compile-fail ones would be nice as well, but I don't know how I'd properly annotate the errors since they wouldn't be coming from the source file itself.

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.
@sfackler
Copy link
Member Author

@alexcrichton updated

bors added a commit that referenced this pull request Jan 24, 2014
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.
@bors bors closed this Jan 24, 2014
@bors bors merged commit d908e97 into rust-lang:master Jan 24, 2014
@sfackler sfackler deleted the macro-export-source branch May 15, 2014 05:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants