mirror of
https://github.com/openharmony/third_party_rust_rust.git
synced 2026-07-16 07:54:55 -04:00
Ensure macros are not affected
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user