Fix unwrapping usize issue in HasMutInterior

This commit is contained in:
varkor
2019-05-30 23:44:28 +01:00
parent eb0afe1845
commit 7e92607f5a
3 changed files with 28 additions and 2 deletions

View File

@@ -0,0 +1,19 @@
// run-pass
#![feature(const_generics)]
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
use std::ops::AddAssign;
fn inc<T: AddAssign + Clone, const N: usize>(v: &mut [T; N]) -> &mut [T; N] {
for x in v.iter_mut() {
*x += x.clone();
}
v
}
fn main() {
let mut v = [1, 2, 3];
inc(&mut v);
assert_eq!(v, [2, 4, 6]);
}