From 3e3e70d529d8c7d7c4d7bc4fefc9f109393b9245 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:19:43 +0200 Subject: Merging upstream version 1.69.0+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/parser/anon-enums-are-ambiguous.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 tests/ui/parser/anon-enums-are-ambiguous.rs (limited to 'tests/ui/parser/anon-enums-are-ambiguous.rs') diff --git a/tests/ui/parser/anon-enums-are-ambiguous.rs b/tests/ui/parser/anon-enums-are-ambiguous.rs new file mode 100644 index 000000000..b0173cf98 --- /dev/null +++ b/tests/ui/parser/anon-enums-are-ambiguous.rs @@ -0,0 +1,26 @@ +// check-pass + +macro_rules! test_expr { + ($expr:expr) => {}; +} + +macro_rules! test_ty { + ($a:ty | $b:ty) => {}; +} + +fn main() { + test_expr!(a as fn() -> B | C); + // Do not break the `|` operator. + + test_expr!(|_: fn() -> B| C | D); + // Do not break `-> Ret` in closure args. + + test_ty!(A | B); + // We can't support anon enums in arbitrary positions. + + test_ty!(fn() -> A | B); + // Don't break fn ptrs. + + test_ty!(impl Fn() -> A | B); + // Don't break parenthesized generics. +} -- cgit v1.2.3