Prohibit macro-expanded extern crate items shadowing crates passed with --extern
This commit is contained in:
parent
7976aa32a9
commit
d1e337bded
5 changed files with 51 additions and 5 deletions
|
|
@ -36,4 +36,11 @@ mod import_absolute {
|
|||
//~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
|
||||
}
|
||||
|
||||
extern crate alloc as core;
|
||||
|
||||
mod unrelated_crate_renamed {
|
||||
type A = core::boxed::Box<u8>;
|
||||
//~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,14 @@ LL | type A = ::alloc::boxed::Box<u8>;
|
|||
|
|
||||
= help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to 8 previous errors
|
||||
error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #54658)
|
||||
--> $DIR/feature-gate-extern_crate_item_prelude.rs:42:14
|
||||
|
|
||||
LL | type A = core::boxed::Box<u8>;
|
||||
| ^^^^
|
||||
|
|
||||
= help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable
|
||||
|
||||
error: aborting due to 9 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
// aux-build:two_macros.rs
|
||||
// compile-flags:--extern non_existent
|
||||
|
||||
mod n {
|
||||
extern crate two_macros;
|
||||
|
|
@ -10,4 +11,12 @@ mod m {
|
|||
}
|
||||
}
|
||||
|
||||
macro_rules! define_std_as_non_existent {
|
||||
() => {
|
||||
extern crate std as non_existent;
|
||||
//~^ ERROR `extern crate` items cannot shadow names passed with `--extern`
|
||||
}
|
||||
}
|
||||
define_std_as_non_existent!();
|
||||
|
||||
fn main() {}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,18 @@
|
|||
error: macro-expanded `extern crate` items cannot shadow names passed with `--extern`
|
||||
--> $DIR/extern-prelude-extern-crate-fail.rs:16:9
|
||||
|
|
||||
LL | extern crate std as non_existent;
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
...
|
||||
LL | define_std_as_non_existent!();
|
||||
| ------------------------------ in this macro invocation
|
||||
|
||||
error[E0433]: failed to resolve. Use of undeclared type or module `two_macros`
|
||||
--> $DIR/extern-prelude-extern-crate-fail.rs:9:9
|
||||
--> $DIR/extern-prelude-extern-crate-fail.rs:10:9
|
||||
|
|
||||
LL | two_macros::m!(); //~ ERROR failed to resolve. Use of undeclared type or module `two_macros`
|
||||
| ^^^^^^^^^^ Use of undeclared type or module `two_macros`
|
||||
|
||||
error: aborting due to previous error
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0433`.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue