Files
rust/tests/ui/array-slice-vec/slice-mut.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

14 lines
368 B
Rust
Raw Permalink Normal View History

// Test mutability and slicing syntax.
fn main() {
let x: &[isize] = &[1, 2, 3, 4, 5];
// Immutable slices are not mutable.
2015-01-20 22:56:53 +09:00
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
}