]> git.proxmox.com Git - rustc.git/blob - src/test/ui/const-generics/infer_arg_from_pat.rs
Merge branch 'debian/experimental2' into debian/experimental
[rustc.git] / src / test / ui / const-generics / infer_arg_from_pat.rs
1 // run-pass
2 //
3 // see issue #70529
4 // revisions: full min
5
6 #![cfg_attr(full, feature(const_generics))]
7 #![cfg_attr(full, allow(incomplete_features))]
8
9 struct A<const N: usize> {
10 arr: [u8; N],
11 }
12
13 impl<const N: usize> A<N> {
14 fn new() -> Self {
15 A {
16 arr: [0; N],
17 }
18 }
19
20 fn value(&self) -> usize {
21 N
22 }
23 }
24
25 fn main() {
26 let a = A::new();
27 let [_, _] = a.arr;
28 assert_eq!(a.value(), 2);
29 }