Ensure macros are not affected

This commit is contained in:
Esteban Küber 2023-01-17 17:02:09 +00:00
parent c847a01a3b
commit 12d18e4031

View 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);
}