]> git.lizzy.rs Git - rust.git/blob - tests/ui/parser/fake-anon-enums-in-macros.rs
Auto merge of #105670 - Xiretza:rustc_parse-diagnostics-4, r=davidtwco
[rust.git] / tests / ui / parser / fake-anon-enums-in-macros.rs
1 // build-pass
2 macro_rules! check_ty {
3     ($Z:ty) => { compile_error!("triggered"); };
4     ($X:ty | $Y:ty) => { $X };
5 }
6
7 macro_rules! check {
8     ($Z:ty) => { compile_error!("triggered"); };
9     ($X:ty | $Y:ty) => { };
10 }
11
12 check! { i32 | u8 }
13
14 fn foo(x: check_ty! { i32 | u8 }) -> check_ty! { i32 | u8 } {
15     x
16 }
17 fn main() {
18     let x: check_ty! { i32 | u8 } = 42;
19     let _: check_ty! { i32 | u8 } = foo(x);
20 }