summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/arg-in-pat-1.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/const-generics/arg-in-pat-1.rs')
-rw-r--r--src/test/ui/const-generics/arg-in-pat-1.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/arg-in-pat-1.rs b/src/test/ui/const-generics/arg-in-pat-1.rs
new file mode 100644
index 000000000..82555084e
--- /dev/null
+++ b/src/test/ui/const-generics/arg-in-pat-1.rs
@@ -0,0 +1,23 @@
+// check-pass
+enum ConstGenericEnum<const N: usize> {
+ Foo([i32; N]),
+ Bar,
+}
+
+fn foo<const N: usize>(val: &ConstGenericEnum<N>) {
+ if let ConstGenericEnum::<N>::Foo(field, ..) = val {}
+}
+
+fn bar<const N: usize>(val: &ConstGenericEnum<N>) {
+ match val {
+ ConstGenericEnum::<N>::Foo(field, ..) => (),
+ ConstGenericEnum::<N>::Bar => (),
+ }
+}
+
+fn main() {
+ match ConstGenericEnum::Bar {
+ ConstGenericEnum::<3>::Foo(field, ..) => (),
+ ConstGenericEnum::<3>::Bar => (),
+ }
+}