Closed
Description
Cargo.toml
[package]
name = "foo"
version = "0.0.0"
[dependencies]
log = "0.4"
src/main.rs
include!("real_main.rs");
src/real_main.rs
#[macro_use] extern crate log;
fn main() {
warn!("!!!");
}
Code like this used to build correctly:
$ rustup run --install nightly-2018-08-02 rustc -V
rustc 1.29.0-nightly (97085f9fb 2018-08-01)
$ rustup run --install nightly-2018-08-02 cargo run
Finished dev [unoptimized + debuginfo] target(s) in 0.01s
Running `target/debug/foo`
And now produces an error whose message seems wrong: it points at the call site of a macro as a "name also defined here":
$ rustup run --install nightly-2018-08-03 rustc -V
rustc 1.30.0-nightly (7e8ca9f8b 2018-08-03)
$ rustup run --install nightly-2018-08-03 cargo run
Compiling foo v0.0.0 (file:///tmp/foo)
error[E0659]: `warn` is ambiguous
--> src/real_main.rs:4:5
|
4 | warn!("!!!");
| ^^^^
|
note: `warn` could refer to the name imported here
--> src/real_main.rs:1:1
|
1 | #[macro_use] extern crate log;
| ^^^^^^^^^^^^
note: `warn` could also refer to the name defined here
--> src/real_main.rs:4:5
|
4 | warn!("!!!");
| ^^^^
= note: macro-expanded macro imports do not shadow
error: aborting due to previous error
For more information about this error, try `rustc --explain E0659`.
error: Could not compile `foo`.
To learn more, run the command again with --verbose.
Commit range between these two nightlies: 97085f9...7e8ca9f
#52841 is the only PR in the range that seems relevant. CC @petrochenkov, @alexcrichton