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 --- .../associated-const-range-match-patterns.rs | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/test/ui/associated-consts/associated-const-range-match-patterns.rs (limited to 'src/test/ui/associated-consts/associated-const-range-match-patterns.rs') diff --git a/src/test/ui/associated-consts/associated-const-range-match-patterns.rs b/src/test/ui/associated-consts/associated-const-range-match-patterns.rs new file mode 100644 index 000000000..5276869a7 --- /dev/null +++ b/src/test/ui/associated-consts/associated-const-range-match-patterns.rs @@ -0,0 +1,40 @@ +// run-pass +#![allow(dead_code, unreachable_patterns)] +#![allow(ellipsis_inclusive_range_patterns)] + +struct Foo; + +trait HasNum { + const NUM: isize; +} +impl HasNum for Foo { + const NUM: isize = 1; +} + +fn main() { + assert!(match 2 { + Foo::NUM ... 3 => true, + _ => false, + }); + assert!(match 0 { + -1 ... ::NUM => true, + _ => false, + }); + assert!(match 1 { + ::NUM ... ::NUM => true, + _ => false, + }); + + assert!(match 2 { + Foo::NUM ..= 3 => true, + _ => false, + }); + assert!(match 0 { + -1 ..= ::NUM => true, + _ => false, + }); + assert!(match 1 { + ::NUM ..= ::NUM => true, + _ => false, + }); +} -- cgit v1.2.3