From 698f8c2f01ea549d77d7dc3338a12e04c11057b9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:02:58 +0200 Subject: Adding upstream version 1.64.0+dfsg1. Signed-off-by: Daniel Baumann --- src/test/ui/binding/optional_comma_in_match_arm.rs | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/test/ui/binding/optional_comma_in_match_arm.rs (limited to 'src/test/ui/binding/optional_comma_in_match_arm.rs') diff --git a/src/test/ui/binding/optional_comma_in_match_arm.rs b/src/test/ui/binding/optional_comma_in_match_arm.rs new file mode 100644 index 000000000..fc268bf2a --- /dev/null +++ b/src/test/ui/binding/optional_comma_in_match_arm.rs @@ -0,0 +1,40 @@ +// run-pass +#![allow(unused_unsafe)] +// ignore-pretty issue #37199 +#![allow(while_true)] + +fn main() { + let x = 1; + + match x { + 1 => loop { break; }, + 2 => while true { break; }, + 3 => if true { () }, + 4 => if true { () } else { () }, + 5 => match () { () => () }, + 6 => { () }, + 7 => unsafe { () }, + _ => (), + } + + match x { + 1 => loop { break; } + 2 => while true { break; } + 3 => if true { () } + 4 => if true { () } else { () } + 5 => match () { () => () } + 6 => { () } + 7 => unsafe { () } + _ => () + } + + let r: &i32 = &x; + + match r { + // Absence of comma should not cause confusion between a pattern + // and a bitwise and. + &1 => if true { () } else { () } + &2 => (), + _ =>() + } +} -- cgit v1.2.3