Skip to content

Enabling "nightly" feature breaks processing of mod in another file #56

New issue

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

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

Already on GitHub? # to your account

Closed
CodeSandwich opened this issue Jan 19, 2018 · 3 comments
Closed

Comments

@CodeSandwich
Copy link

Situation

my_mod is a module with body in file my_mod.rs. To include it in the project it must be declared in another file, let's say lib.rs. I'm trying to push whole my_mod into proc macro my_macro, so I write in lib.rs:

#[my_macro]
mod my_mod;

Without "nightly" feature

Whole content of my_mod is passed into macro.

With "nightly" feature

Only mod my_mod; is passed into macro.

Question

Is it regression or is it the way proc macros 2.0 are supposed to work?

@mystor
Copy link
Contributor

mystor commented Jan 19, 2018

This sounds like a rustc issue - I'm not sure. It's surprising that the to_string method would produce such a dramatically different result than the TokenStream.

@dtolnay
Copy link
Owner

dtolnay commented Jan 21, 2018

I don't think we can fix this in proc-macro2 so I filed rust-lang/rust#47627 to follow up in the compiler. Thanks!

@dtolnay dtolnay closed this as completed Jan 21, 2018
@CodeSandwich
Copy link
Author

Thank you for investigation and filing a root cause issue!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants