diff options
| author | bors <bors@rust-lang.org> | 2018-11-21 02:30:35 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-11-21 02:30:35 +0000 |
| commit | 780658a464603fa755d94b27f72a375bd81d07ea (patch) | |
| tree | 18787e8fd66be67f6a3dfee5a48bc604f530fdca /src/test | |
| parent | f1e2fa8f0469aac1ea69dd5b6164e1d198d57934 (diff) | |
| parent | d4934c748fd9bb74d08d38f240eadf3455777ffb (diff) | |
| download | rust-780658a464603fa755d94b27f72a375bd81d07ea.tar.gz rust-780658a464603fa755d94b27f72a375bd81d07ea.zip | |
Auto merge of #56032 - petrochenkov:stabecip, r=nikomatsakis
Stabilize `extern_crate_item_prelude` Closes https://github.com/rust-lang/rust/issues/55599
Diffstat (limited to 'src/test')
9 files changed, 33 insertions, 133 deletions
diff --git a/src/test/ui-fulldeps/proc-macro/extern-prelude-extern-crate-proc-macro.rs b/src/test/ui-fulldeps/proc-macro/extern-prelude-extern-crate-proc-macro.rs index e320ad97135..25a2a376147 100644 --- a/src/test/ui-fulldeps/proc-macro/extern-prelude-extern-crate-proc-macro.rs +++ b/src/test/ui-fulldeps/proc-macro/extern-prelude-extern-crate-proc-macro.rs @@ -1,8 +1,6 @@ // compile-pass // edition:2018 -#![feature(extern_crate_item_prelude)] - extern crate proc_macro; use proc_macro::TokenStream; // OK diff --git a/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.rs b/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.rs deleted file mode 100644 index 27b9a34ff4e..00000000000 --- a/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.rs +++ /dev/null @@ -1,46 +0,0 @@ -// edition:2018 - -#![feature(alloc, underscore_imports)] - -extern crate alloc; - -mod in_scope { - fn check() { - let v = alloc::vec![0]; - //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable - type A = alloc::boxed::Box<u8>; - //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable - } -} - -mod absolute { - fn check() { - let v = ::alloc::vec![0]; - //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable - type A = ::alloc::boxed::Box<u8>; - //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable - } -} - -mod import_in_scope { - use alloc as _; - //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable - use alloc::boxed; - //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable -} - -mod import_absolute { - use ::alloc; - //~^ ERROR use of extern prelude names introduced with `extern crate` items is unstable - use ::alloc::boxed; - //~^ 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() {} diff --git a/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr b/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr deleted file mode 100644 index 103ab79ef84..00000000000 --- a/src/test/ui/feature-gates/feature-gate-extern_crate_item_prelude.stderr +++ /dev/null @@ -1,75 +0,0 @@ -error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599) - --> $DIR/feature-gate-extern_crate_item_prelude.rs:26:9 - | -LL | use alloc as _; - | ^^^^^ - | - = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable - -error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599) - --> $DIR/feature-gate-extern_crate_item_prelude.rs:28:9 - | -LL | use alloc::boxed; - | ^^^^^ - | - = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable - -error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599) - --> $DIR/feature-gate-extern_crate_item_prelude.rs:33:11 - | -LL | use ::alloc; - | ^^^^^ - | - = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable - -error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599) - --> $DIR/feature-gate-extern_crate_item_prelude.rs:35:11 - | -LL | use ::alloc::boxed; - | ^^^^^ - | - = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable - -error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599) - --> $DIR/feature-gate-extern_crate_item_prelude.rs:9:17 - | -LL | let v = alloc::vec![0]; - | ^^^^^ - | - = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable - -error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599) - --> $DIR/feature-gate-extern_crate_item_prelude.rs:11:18 - | -LL | type A = alloc::boxed::Box<u8>; - | ^^^^^ - | - = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable - -error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599) - --> $DIR/feature-gate-extern_crate_item_prelude.rs:18:19 - | -LL | let v = ::alloc::vec![0]; - | ^^^^^ - | - = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable - -error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599) - --> $DIR/feature-gate-extern_crate_item_prelude.rs:20:20 - | -LL | type A = ::alloc::boxed::Box<u8>; - | ^^^^^ - | - = help: add #![feature(extern_crate_item_prelude)] to the crate attributes to enable - -error[E0658]: use of extern prelude names introduced with `extern crate` items is unstable (see issue #55599) - --> $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`. diff --git a/src/test/ui/imports/extern-prelude-extern-crate-absolute-expanded.rs b/src/test/ui/imports/extern-prelude-extern-crate-absolute-expanded.rs index b1154f2076b..cf91a9714ad 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-absolute-expanded.rs +++ b/src/test/ui/imports/extern-prelude-extern-crate-absolute-expanded.rs @@ -1,8 +1,6 @@ // compile-pass // edition:2018 -#![feature(extern_crate_item_prelude)] - macro_rules! define_iso { () => { extern crate std as iso; }} diff --git a/src/test/ui/imports/extern-prelude-extern-crate-cfg.rs b/src/test/ui/imports/extern-prelude-extern-crate-cfg.rs index c48a65798b6..6117e5f6f3c 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-cfg.rs +++ b/src/test/ui/imports/extern-prelude-extern-crate-cfg.rs @@ -1,7 +1,6 @@ // compile-pass // compile-flags:--cfg my_feature -#![feature(extern_crate_item_prelude)] #![no_std] #[cfg(my_feature)] diff --git a/src/test/ui/imports/extern-prelude-extern-crate-pass.rs b/src/test/ui/imports/extern-prelude-extern-crate-pass.rs index 8c147dfd04a..bb4cf6ca99c 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-pass.rs +++ b/src/test/ui/imports/extern-prelude-extern-crate-pass.rs @@ -1,8 +1,6 @@ // compile-pass // aux-build:two_macros.rs -#![feature(extern_crate_item_prelude)] - extern crate two_macros; mod m { diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs index 732f1c4de2f..6ff3ab73639 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.rs @@ -1,7 +1,5 @@ // aux-build:two_macros.rs -#![feature(extern_crate_item_prelude)] - macro_rules! define_vec { () => { extern crate std as Vec; @@ -16,4 +14,13 @@ mod m { } } +macro_rules! define_other_core { + () => { + extern crate std as core; + //~^ ERROR macro-expanded `extern crate` items cannot shadow names passed with `--extern` + } +} + +define_other_core!(); + fn main() {} diff --git a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr index 218dfb796f7..795e1761ccd 100644 --- a/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr +++ b/src/test/ui/imports/extern-prelude-extern-crate-restricted-shadowing.stderr @@ -1,12 +1,21 @@ +error: macro-expanded `extern crate` items cannot shadow names passed with `--extern` + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:19:9 + | +LL | extern crate std as core; + | ^^^^^^^^^^^^^^^^^^^^^^^^^ +... +LL | define_other_core!(); + | --------------------- in this macro invocation + error[E0659]: `Vec` is ambiguous (macro-expanded name vs less macro-expanded name from outer scope during import/macro resolution) - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:15:9 + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:13:9 | LL | Vec::panic!(); //~ ERROR `Vec` is ambiguous | ^^^ ambiguous name | = note: `Vec` could refer to a struct from prelude note: `Vec` could also refer to the extern crate imported here - --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:7:9 + --> $DIR/extern-prelude-extern-crate-restricted-shadowing.rs:5:9 | LL | extern crate std as Vec; | ^^^^^^^^^^^^^^^^^^^^^^^^ @@ -14,6 +23,6 @@ LL | extern crate std as Vec; LL | define_vec!(); | -------------- in this macro invocation -error: aborting due to previous error +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0659`. diff --git a/src/test/ui/imports/extern-prelude-extern-crate-shadowing.rs b/src/test/ui/imports/extern-prelude-extern-crate-shadowing.rs new file mode 100644 index 00000000000..c5adeaf17fa --- /dev/null +++ b/src/test/ui/imports/extern-prelude-extern-crate-shadowing.rs @@ -0,0 +1,12 @@ +// compile-pass +// aux-build:two_macros.rs + +extern crate two_macros as core; + +mod m { + fn check() { + core::m!(); // OK + } +} + +fn main() {} |
