]> git.lizzy.rs Git - rust.git/blob - tests/ui/const-generics/infer_arg_from_pat.rs
Rollup merge of #106427 - mejrs:translation_errors, r=davidtwco
[rust.git] / tests / ui / const-generics / infer_arg_from_pat.rs
1 // run-pass
2 //
3 // see issue #70529
4
5 struct A<const N: usize> {
6     arr: [u8; N],
7 }
8
9 impl<const N: usize> A<N> {
10     fn new() -> Self {
11         A {
12             arr: [0; N],
13         }
14     }
15
16     fn value(&self) -> usize {
17         N
18     }
19 }
20
21 fn main() {
22     let a = A::new();
23     let [_, _] = a.arr;
24     assert_eq!(a.value(), 2);
25 }