-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Change std inject attributes to outer attributes #14320
Conversation
The #[phase(syntax,link)] attribute on `extern crate std` needs to be an outer attribute so it can pretty-print properly. Also add `#![no_std]` and `#[feature(phase)]` so compiling the pretty-printed source will work.
Can tests be added for this? Injecting |
@alexcrichton I don't know how to test this, but I ran Why would And when compiling the |
FWIW I just searched for |
macro_rules! foo( () => (mod foo { fn bar() -> Option<int> { Some(3) } }) )
foo!()
fn main() {
foo::bar();
} When expanded, this will have Also, why is |
@alexcrichton Still compiles fine (both the normal version and recompiling the
Because You can reproduce this right now. The following compiles: #![feature(phase)]
#![no_std]
#[phase(syntax,link)]
extern crate std = "std#0.11.0-pre";
extern crate native = "native#0.11.0-pre";
extern crate std = "std#0.11.0-pre";
extern crate native = "native#0.11.0-pre";
fn main() {} This is basically what you get when you recompile the expanded form of But the following, which is what you get after fixing the #![feature(phase)]
#![no_std]
#[phase(syntax,link)]
extern crate std = "std#0.11.0-pre";
extern crate native = "native#0.11.0-pre";
#[phase(syntax,link)]
extern crate std = "std#0.11.0-pre";
extern crate native = "native#0.11.0-pre";
fn main() {} The error message says:
|
That error is quite worrisome (I opened an issue, #14330). Also, it appears I need to go to bed sooner, of course the modules are expanded and have their preludes injected later! |
…richton The #[phase(syntax,link)] attribute on `extern crate std` needs to be an outer attribute so it can pretty-print properly. Also add `#![no_std]` and `#[feature(phase)]` so compiling the pretty-printed source will work.
The #[phase(syntax,link)] attribute on
extern crate std
needs to be anouter attribute so it can pretty-print properly.
Also add
#![no_std]
and#[feature(phase)]
so compiling thepretty-printed source will work.