Fix unwrapping usize issue in HasMutInterior
This commit is contained in:
19
src/test/ui/const-generics/mut-ref-const-param-array.rs
Normal file
19
src/test/ui/const-generics/mut-ref-const-param-array.rs
Normal 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]);
|
||||
}
|
||||
Reference in New Issue
Block a user