2014-09-15 03:48:58 -05:00
|
|
|
// Test mutability and slicing syntax.
|
|
|
|
|
|
|
|
fn main() {
|
2015-01-08 04:54:35 -06:00
|
|
|
let x: &[isize] = &[1, 2, 3, 4, 5];
|
2014-09-15 03:48:58 -05:00
|
|
|
// Immutable slices are not mutable.
|
2015-01-27 08:39:53 -06:00
|
|
|
|
2015-01-20 07:56:53 -06:00
|
|
|
let y: &mut[_] = &x[2..4];
|
|
|
|
//~^ ERROR mismatched types
|
2019-11-13 16:16:56 -06:00
|
|
|
//~| expected mutable reference `&mut [_]`
|
|
|
|
//~| found reference `&[isize]`
|
2016-08-19 18:05:37 -05:00
|
|
|
//~| types differ in mutability
|
2014-09-15 03:48:58 -05:00
|
|
|
}
|