summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/infer_arg_from_pat.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/const-generics/infer_arg_from_pat.rs')
-rw-r--r--src/test/ui/const-generics/infer_arg_from_pat.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/test/ui/const-generics/infer_arg_from_pat.rs b/src/test/ui/const-generics/infer_arg_from_pat.rs
new file mode 100644
index 000000000..10317a1b9
--- /dev/null
+++ b/src/test/ui/const-generics/infer_arg_from_pat.rs
@@ -0,0 +1,25 @@
+// run-pass
+//
+// see issue #70529
+
+struct A<const N: usize> {
+ arr: [u8; N],
+}
+
+impl<const N: usize> A<N> {
+ fn new() -> Self {
+ A {
+ arr: [0; N],
+ }
+ }
+
+ fn value(&self) -> usize {
+ N
+ }
+}
+
+fn main() {
+ let a = A::new();
+ let [_, _] = a.arr;
+ assert_eq!(a.value(), 2);
+}