]> git.lizzy.rs Git - rust.git/blob - tests/ui/array-slice-vec/slice-mut.rs
Auto merge of #106458 - albertlarsan68:move-tests, r=jyn514
[rust.git] / tests / ui / array-slice-vec / slice-mut.rs
1 // Test mutability and slicing syntax.
2
3 fn main() {
4     let x: &[isize] = &[1, 2, 3, 4, 5];
5     // Immutable slices are not mutable.
6
7     let y: &mut[_] = &x[2..4];
8     //~^ ERROR mismatched types
9     //~| expected mutable reference `&mut [_]`
10     //~| found reference `&[isize]`
11     //~| types differ in mutability
12 }