summaryrefslogtreecommitdiffstats
path: root/tests/ui/assign-imm-local-twice.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/assign-imm-local-twice.rs')
-rw-r--r--tests/ui/assign-imm-local-twice.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/ui/assign-imm-local-twice.rs b/tests/ui/assign-imm-local-twice.rs
new file mode 100644
index 000000000..b50f6ab5d
--- /dev/null
+++ b/tests/ui/assign-imm-local-twice.rs
@@ -0,0 +1,13 @@
+fn test() {
+ let v: isize;
+ //~^ HELP consider making this binding mutable
+ //~| SUGGESTION mut v
+ v = 1; //~ NOTE first assignment
+ println!("v={}", v);
+ v = 2; //~ ERROR cannot assign twice to immutable variable
+ //~| NOTE cannot assign twice to immutable
+ println!("v={}", v);
+}
+
+fn main() {
+}