]> git.lizzy.rs Git - rust.git/blob - src/test/ui/uniform-paths/macros.rs
Rollup merge of #95376 - WaffleLapkin:drain_keep_rest, r=dtolnay
[rust.git] / src / test / ui / uniform-paths / macros.rs
1 // This test is similar to `basic.rs`, but with macros defining local items.
2
3 // run-pass
4 // edition:2018
5
6 #![allow(non_camel_case_types)]
7
8 // Test that ambiguity errors are not emitted between `self::test` and
9 // `::test`, assuming the latter (crate) is not in `extern_prelude`.
10 macro_rules! m1 {
11     () => {
12         mod test {
13             pub struct Foo(pub ());
14         }
15     }
16 }
17 use test::Foo;
18 m1!();
19
20 // Test that qualified paths can refer to both the external crate and local item.
21 macro_rules! m2 {
22     () => {
23         mod std {
24             pub struct io(pub ());
25         }
26     }
27 }
28 use ::std::io as std_io;
29 use self::std::io as local_io;
30 m2!();
31
32 fn main() {
33     Foo(());
34     let _ = std_io::stdout();
35     local_io(());
36 }