]> git.proxmox.com Git - rustc.git/blob - src/test/ui/const-generics/infer_arg_from_pat.rs
Update upstream source from tag 'upstream/1.47.0_beta.2+dfsg1'
[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 #![cfg_attr(min, feature(min_const_generics))]
9
10 struct A<const N: usize> {
11 arr: [u8; N],
12 }
13
14 impl<const N: usize> A<N> {
15 fn new() -> Self {
16 A {
17 arr: [0; N],
18 }
19 }
20
21 fn value(&self) -> usize {
22 N
23 }
24 }
25
26 fn main() {
27 let a = A::new();
28 let [_, _] = a.arr;
29 assert_eq!(a.value(), 2);
30 }