]> git.lizzy.rs Git - rust.git/blob - tests/ui/macros/macro-shadowing.rs
Rollup merge of #106244 - atouchet:readme3, r=workingjubilee
[rust.git] / tests / ui / macros / macro-shadowing.rs
1 // aux-build:two_macros.rs
2
3 #![allow(unused_macros)]
4
5 macro_rules! foo { () => {} }
6 macro_rules! macro_one { () => {} }
7 #[macro_use(macro_two)] extern crate two_macros;
8
9 macro_rules! m1 { () => {
10     macro_rules! foo { () => {} }
11
12     #[macro_use] //~ ERROR `macro_two` is already in scope
13     extern crate two_macros as __;
14 }}
15 m1!();
16
17 foo!(); //~ ERROR `foo` is ambiguous
18
19 macro_rules! m2 { () => {
20     macro_rules! foo { () => {} }
21     foo!();
22 }}
23 m2!();
24 //^ Since `foo` is not used outside this expansion, it is not a shadowing error.
25
26 fn main() {}