From 64d98f8ee037282c35007b64c2649055c56af1db Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:03 +0200 Subject: Merging upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/macros/macro-shadowing.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/ui/macros/macro-shadowing.rs (limited to 'tests/ui/macros/macro-shadowing.rs') diff --git a/tests/ui/macros/macro-shadowing.rs b/tests/ui/macros/macro-shadowing.rs new file mode 100644 index 000000000..7f956dd7d --- /dev/null +++ b/tests/ui/macros/macro-shadowing.rs @@ -0,0 +1,26 @@ +// aux-build:two_macros.rs + +#![allow(unused_macros)] + +macro_rules! foo { () => {} } +macro_rules! macro_one { () => {} } +#[macro_use(macro_two)] extern crate two_macros; + +macro_rules! m1 { () => { + macro_rules! foo { () => {} } + + #[macro_use] //~ ERROR `macro_two` is already in scope + extern crate two_macros as __; +}} +m1!(); + +foo!(); //~ ERROR `foo` is ambiguous + +macro_rules! m2 { () => { + macro_rules! foo { () => {} } + foo!(); +}} +m2!(); +//^ Since `foo` is not used outside this expansion, it is not a shadowing error. + +fn main() {} -- cgit v1.2.3