summaryrefslogtreecommitdiffstats
path: root/src/test/ui/writing-to-immutable-vec.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/writing-to-immutable-vec.rs')
-rw-r--r--src/test/ui/writing-to-immutable-vec.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/test/ui/writing-to-immutable-vec.rs b/src/test/ui/writing-to-immutable-vec.rs
new file mode 100644
index 000000000..dbcc3f0bb
--- /dev/null
+++ b/src/test/ui/writing-to-immutable-vec.rs
@@ -0,0 +1,4 @@
+fn main() {
+ let v: Vec<isize> = vec![1, 2, 3];
+ v[1] = 4; //~ ERROR cannot borrow `v` as mutable, as it is not declared as mutable
+}