Description
Use statements for proc_macro
that worked in nightly-(2ab3eba 2018-09-14) don't work in (e4ba1d4 2018-09-15) (including all newer nightlies up to at least (3bc2ca7 2018-09-20) and the RC1 beta) anymore.
I tried this code:
src/lib.rs
use proc_macro::TokenStream;
#[proc_macro]
pub fn foo(input: TokenStream) -> TokenStream {
input
}
Cargo.toml
[package]
name = "proc-fail"
version = "0.1.0"
authors = ["me"]
edition = "2018"
[lib]
proc-macro = true
[dependencies]
As said, compiling with (2ab3eba 2018-09-14), everything works. But compiling with (e4ba1d4 2018-09-15) results in:
Error (1)
error[E0432]: unresolved import `proc_macro`
--> src/lib.rs:3:5
|
3 | use proc_macro::TokenStream;
| ^^^^^^^^^^ Could not find `proc_macro` in `{{root}}`
I tried different configurations with the two different nightly versions. The error in edition = "2015"
without the extern crate is expected, of course (or is it? I'm confused now).
With nightly-(2ab3eba 2018-09-14):
edition = "2015" |
edition = "2018" |
|
---|---|---|
with extern crate proc_macro |
works | works |
without extern crate proc_macro |
fails (3) | works |
With nightly- (e4ba1d4 2018-09-15):
edition = "2015" |
edition = "2018" |
|
---|---|---|
with extern crate proc_macro |
works | fails (2) |
without extern crate proc_macro |
fails (3) | fails (1) (the case described above) |
Error (2)
error[E0432]: unresolved import `proc_macro`
--> src/lib.rs:3:5
|
3 | use proc_macro::TokenStream;
| ^^^^^^^^^^ Did you mean `self::proc_macro`?
Error (3)
error[E0432]: unresolved import `proc_macro`
--> src/lib.rs:3:5
|
3 | use proc_macro::TokenStream;
| ^^^^^^^^^^ Did you mean `registrar::proc_macro`?
I couldn't really find any information about this. So the only way to make it work right now is to either use edition 2015 with extern crate or edition 2018 with extern crate and use self::proc_macro
.
Is this intended or an unwanted regression?