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