diff options
Diffstat (limited to 'tests/ui/array-slice-vec/slice-mut.rs')
-rw-r--r-- | tests/ui/array-slice-vec/slice-mut.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/ui/array-slice-vec/slice-mut.rs b/tests/ui/array-slice-vec/slice-mut.rs new file mode 100644 index 000000000..e9989f0f4 --- /dev/null +++ b/tests/ui/array-slice-vec/slice-mut.rs @@ -0,0 +1,12 @@ +// 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 + //~| expected mutable reference `&mut [_]` + //~| found reference `&[isize]` + //~| types differ in mutability +} |