Closed
Description
Testing out building a crate graph with -Z build-std=std,alloc
(note that the need to pass alloc
is a separate bug) ends up yielding:
Compiling crossbeam-utils v0.6.6
error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
--> /home/alex/.cargo/registry/src/github.com-1ecc6299db9ec823/crossbeam-utils-0.6.6/src/lib.rs:43:9
|
43 | extern crate std as alloc;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: aborting due to previous error
error: Could not compile `crossbeam-utils`.
To learn more, run the command again with --verbose.
Sure enough this code:
macro_rules! a {
() => (extern crate std as alloc;)
}
a!();
fails to compile:
$ rustc +nightly foo.rs --crate-type rlib --extern alloc -Z unstable-options
error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
--> foo.rs:2:12
|
2 | () => (extern crate std as alloc;)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
3 | }
4 | a!();
| ----- in this macro invocation
error: aborting due to previous error
I'm not entirely sure the origin of this error, but it seems that we either need to:
- Instead use
--sysroot
- Figure out if rustc can avoid error'ing in this case (maybe via more cli flags)