]>
Commit | Line | Data |
---|---|---|
69743fb6 | 1 | // This test is similar to `basic.rs`, but with macros defining local items. |
b7449926 XL |
2 | |
3 | // run-pass | |
b7449926 XL |
4 | // edition:2018 |
5 | ||
69743fb6 | 6 | #![allow(non_camel_case_types)] |
b7449926 XL |
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 | std_io::stdout(); | |
35 | local_io(()); | |
36 | } |