]> git.lizzy.rs Git - rust.git/blob - src/test/ui/hygiene/prelude-import-hygiene.rs
Rollup merge of #90202 - matthewjasper:xcrate-hygiene, r=petrochenkov
[rust.git] / src / test / ui / hygiene / prelude-import-hygiene.rs
1 // Make sure that attribute used when injecting the prelude are resolved
2 // hygienically.
3
4 // check-pass
5 // aux-build:not-libstd.rs
6
7 //revisions: rust2015 rust2018
8 //[rust2018] edition:2018
9
10 // The prelude import shouldn't see these as candidates for when it's trying to
11 // use the built-in macros.
12 extern crate core;
13 use core::prelude::v1::test as prelude_import;
14 use core::prelude::v1::test as macro_use;
15
16 // Should not be used for the prelude import - not a concern in the 2015 edition
17 // because `std` is already declared in the crate root.
18 #[cfg(rust2018)]
19 extern crate not_libstd as std;
20
21 #[cfg(rust2018)]
22 mod x {
23     // The extern crate item should override `std` in the extern prelude.
24     fn f() {
25         std::not_in_lib_std();
26     }
27 }
28
29 fn main() {}