rust/tests/ui/imports/shadow_builtin_macros.rs
Lukas Wirth 23d5231607 Use non-2015 edition paths in tests that do not test for their resolution
This allows for testing these tests on editions other than 2015
2025-06-03 10:13:33 +02:00

53 lines
793 B
Rust

//@ aux-build:two_macros.rs
mod foo {
extern crate two_macros;
pub use self::two_macros::m as panic;
}
mod m1 {
use crate::foo::panic; // ok
fn f() { panic!(); }
}
mod m2 {
use crate::foo::*;
fn f() { panic!(); } //~ ERROR ambiguous
}
mod m3 {
::two_macros::m!(use crate::foo::panic;);
fn f() { panic!(); } //~ ERROR ambiguous
}
mod m4 {
macro_rules! panic { () => {} } // ok
panic!();
}
mod m5 {
macro_rules! m { () => {
macro_rules! panic { () => {} }
} }
m!();
panic!(); //~ ERROR `panic` is ambiguous
}
#[macro_use(n)]
extern crate two_macros;
mod bar {
pub use two_macros::m as n;
}
mod m6 {
use crate::bar::n; // ok
n!();
}
mod m7 {
use crate::bar::*;
n!(); //~ ERROR ambiguous
}
fn main() {}