]> git.proxmox.com Git - rustc.git/blame - src/test/ui/uniform-paths/macros-nested.rs
Update unsuspicious file list
[rustc.git] / src / test / ui / uniform-paths / macros-nested.rs
CommitLineData
69743fb6 1// This test is similar to `macros.rs`, but nested in modules.
b7449926
XL
2
3// run-pass
b7449926
XL
4// edition:2018
5
69743fb6 6#![allow(non_camel_case_types)]
b7449926
XL
7
8mod foo {
9 // Test that ambiguity errors are not emitted between `self::test` and
10 // `::test`, assuming the latter (crate) is not in `extern_prelude`.
11 macro_rules! m1 {
12 () => {
13 mod test {
14 pub struct Foo(pub ());
15 }
16 }
17 }
18 pub use test::Foo;
19 m1!();
20
21 // Test that qualified paths can refer to both the external crate and local item.
22 macro_rules! m2 {
23 () => {
24 mod std {
25 pub struct io(pub ());
26 }
27 }
28 }
29 pub use ::std::io as std_io;
30 pub use self::std::io as local_io;
31 m2!();
32}
33
34// Test that we can refer to the external crate unqualified
35// (when there isn't a local item with the same name).
36use std::io;
37
38mod bar {
39 // Also test the unqualified external crate import in a nested module,
40 // to show that the above import doesn't resolve through a local `std`
0731742a 41 // item, e.g., the automatically injected `extern crate std;`, which in
b7449926
XL
42 // the Rust 2018 should no longer be visible through `crate::std`.
43 pub use std::io;
44}
45
46
47fn main() {
48 foo::Foo(());
3c0e092e 49 let _ = foo::std_io::stdout();
b7449926 50 foo::local_io(());
3c0e092e
XL
51 let _ = io::stdout();
52 let _ = bar::io::stdout();
b7449926 53}