]> git.lizzy.rs Git - rust.git/blob - src/test/ui/imports/shadow_builtin_macros.rs
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / imports / shadow_builtin_macros.rs
1 // Copyright 2017 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // aux-build:two_macros.rs
12
13 mod foo {
14     extern crate two_macros;
15     pub use self::two_macros::m as panic;
16 }
17
18 mod m1 {
19     use foo::panic; // ok
20     fn f() { panic!(); }
21 }
22
23 mod m2 {
24     use foo::*;
25     fn f() { panic!(); } //~ ERROR ambiguous
26 }
27
28 mod m3 {
29     ::two_macros::m!(use foo::panic;);
30     fn f() { panic!(); } //~ ERROR ambiguous
31 }
32
33 mod m4 {
34     macro_rules! panic { () => {} } // ok
35     panic!();
36 }
37
38 mod m5 {
39     macro_rules! m { () => {
40         macro_rules! panic { () => {} }
41     } }
42     m!();
43     panic!(); //~ ERROR `panic` is ambiguous
44 }
45
46 #[macro_use(n)]
47 extern crate two_macros;
48 mod bar {
49     pub use two_macros::m as n;
50 }
51
52 mod m6 {
53     use bar::n; // ok
54     n!();
55 }
56
57 mod m7 {
58     use bar::*;
59     n!(); //~ ERROR ambiguous
60 }
61
62 fn main() {}