]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/mut-ref-const-param-array.rs
Add revisions to const generic type-dependent UI tests.
[rust.git] / src / test / ui / const-generics / mut-ref-const-param-array.rs
1 // run-pass
2 // revisions: full min
3
4 #![cfg_attr(full, feature(const_generics))]
5 #![cfg_attr(full, allow(incomplete_features))]
6 #![cfg_attr(min, feature(min_const_generics))]
7
8
9 use std::ops::AddAssign;
10
11 fn inc<T: AddAssign + Clone, const N: usize>(v: &mut [T; N]) -> &mut [T; N] {
12     for x in v.iter_mut() {
13         *x += x.clone();
14     }
15     v
16 }
17
18 fn main() {
19     let mut v = [1, 2, 3];
20     inc(&mut v);
21     assert_eq!(v, [2, 4, 6]);
22 }