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
|
|
|
// Can't mutably slice an immutable slice
|
2015-01-08 04:54:35 -06:00
|
|
|
let slice: &mut [isize] = &mut [0, 1];
|
2015-01-08 08:12:06 -06:00
|
|
|
let _ = &mut x[2..4]; //~ERROR cannot borrow immutable borrowed content `*x` as mutable
|
2014-09-15 03:48:58 -05:00
|
|
|
}
|