summaryrefslogtreecommitdiffstats
path: root/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs')
-rw-r--r--src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs
new file mode 100644
index 000000000..c9b16e439
--- /dev/null
+++ b/src/test/ui/liveness/liveness-assign/liveness-assign-imm-local-with-drop.rs
@@ -0,0 +1,12 @@
+fn test() {
+ let b = Box::new(1); //~ NOTE first assignment
+ //~| HELP consider making this binding mutable
+ //~| SUGGESTION mut b
+ drop(b);
+ b = Box::new(2); //~ ERROR cannot assign twice to immutable variable `b`
+ //~| NOTE cannot assign twice to immutable
+ drop(b);
+}
+
+fn main() {
+}