From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/macros/macro-shadowing.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 src/test/ui/macros/macro-shadowing.rs (limited to 'src/test/ui/macros/macro-shadowing.rs') diff --git a/src/test/ui/macros/macro-shadowing.rs b/src/test/ui/macros/macro-shadowing.rs new file mode 100644 index 000000000..7f956dd7d --- /dev/null +++ b/src/test/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