about summary refs log tree commit diff
path: root/tests/ui/array-slice-vec/slice-mut.rs
blob: baa05c36a9db04561b794ae716dbbfd3cb45b93f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
// Test mutability and slicing syntax.

fn main() {
    let x: &[isize] = &[1, 2, 3, 4, 5];
    // Immutable slices are not mutable.

    let y: &mut[_] = &x[2..4];
    //~^ ERROR mismatched types
    //~| NOTE expected mutable reference `&mut [_]`
    //~| NOTE found reference `&[isize]`
    //~| NOTE types differ in mutability
    //~| NOTE expected due to this
}