about summary refs log tree commit diff
diff options
context:
space:
mode:
-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
     }