mirror of
https://github.com/rust-lang/rust.git
synced 2024-10-31 22:41:50 +00:00
Ensure macros are not affected
This commit is contained in:
parent
c847a01a3b
commit
12d18e4031
20
tests/ui/parser/fake-anon-enums-in-macros.rs
Normal file
20
tests/ui/parser/fake-anon-enums-in-macros.rs
Normal file
@ -0,0 +1,20 @@
|
||||
// build-pass
|
||||
macro_rules! check_ty {
|
||||
($Z:ty) => { compile_error!("triggered"); };
|
||||
($X:ty | $Y:ty) => { $X };
|
||||
}
|
||||
|
||||
macro_rules! check {
|
||||
($Z:ty) => { compile_error!("triggered"); };
|
||||
($X:ty | $Y:ty) => { };
|
||||
}
|
||||
|
||||
check! { i32 | u8 }
|
||||
|
||||
fn foo(x: check_ty! { i32 | u8 }) -> check_ty! { i32 | u8 } {
|
||||
x
|
||||
}
|
||||
fn main() {
|
||||
let x: check_ty! { i32 | u8 } = 42;
|
||||
let _: check_ty! { i32 | u8 } = foo(x);
|
||||
}
|
Loading…
Reference in New Issue
Block a user