]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/mut-ref-const-param-array.rs
pin docs: add some forward references
[rust.git] / src / test / ui / const-generics / mut-ref-const-param-array.rs
1 // run-pass
2
3 #![feature(const_generics)]
4 //~^ WARN the feature `const_generics` is incomplete
5
6 use std::ops::AddAssign;
7
8 fn inc<T: AddAssign + Clone, const N: usize>(v: &mut [T; N]) -> &mut [T; N] {
9     for x in v.iter_mut() {
10         *x += x.clone();
11     }
12     v
13 }
14
15 fn main() {
16     let mut v = [1, 2, 3];
17     inc(&mut v);
18     assert_eq!(v, [2, 4, 6]);
19 }