about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIsaac van Bakel <ivb@vanbakel.io>2017-08-06 18:25:31 +0100
committerIsaac van Bakel <ivb@vanbakel.io>2017-08-06 18:25:31 +0100
commitd1fffd8685748357a079711dde1ae22560c6cd70 (patch)
treedacf3661861080097eb5803e4b1f01527db9ffb3
parent9c854db82b767ddd228dbff1e51bb3eed87464b4 (diff)
downloadrust-d1fffd8685748357a079711dde1ae22560c6cd70.tar.gz
rust-d1fffd8685748357a079711dde1ae22560c6cd70.zip
Added closure test case.
-rw-r--r--src/test/compile-fail/lint-unused-mut-variables.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/compile-fail/lint-unused-mut-variables.rs b/src/test/compile-fail/lint-unused-mut-variables.rs
index 49ba9421d65..26d00755da3 100644
--- a/src/test/compile-fail/lint-unused-mut-variables.rs
+++ b/src/test/compile-fail/lint-unused-mut-variables.rs
@@ -54,6 +54,12 @@ fn main() {
     let mut b = (&mut a,);
     *b.0 = 4; //~^ ERROR: variable does not need to be mutable
 
+    let mut x = &mut 1; //~ ERROR: variable does not need to be mutable
+    let mut f = || {
+      *x += 1;
+    };
+    f();
+
     fn mut_ref_arg(mut arg : &mut [u8]) -> &mut [u8] {
         &mut arg[..] //~^ ERROR: variable does not need to be mutable
     }