summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2018-05-04 08:22:13 +0000
committerbors <bors@rust-lang.org>2018-05-04 08:22:13 +0000
commit22a41e45157869b9a4d2ab7a21c7142a93d35cb1 (patch)
treee17da6cbd2c5e0abf1cfbc91be40f30e6db8a535 /src/test
parente78c51adc2a51fbec1d254d2ba8d8718688c7429 (diff)
parent4bc48480c08b9749e6b7f1701a1e03529496382d (diff)
downloadrust-22a41e45157869b9a4d2ab7a21c7142a93d35cb1.tar.gz
rust-22a41e45157869b9a4d2ab7a21c7142a93d35cb1.zip
Auto merge of #50409 - KiChjang:issue-50343, r=nikomatsakis
Skip checking for unused mutable locals that have no name

Fixes #50343.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/nll/unused-mut-issue-50343.rs17
-rw-r--r--src/test/run-pass/nll/issue-50343.rs17
2 files changed, 34 insertions, 0 deletions
diff --git a/src/test/compile-fail/nll/unused-mut-issue-50343.rs b/src/test/compile-fail/nll/unused-mut-issue-50343.rs
new file mode 100644
index 00000000000..e9110b8114b
--- /dev/null
+++ b/src/test/compile-fail/nll/unused-mut-issue-50343.rs
@@ -0,0 +1,17 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(nll)]
+#![deny(unused_mut)]
+
+fn main() {
+    vec![(42, 22)].iter().map(|(mut x, _y)| ()).count();
+    //~^ ERROR: variable does not need to be mutable
+}
diff --git a/src/test/run-pass/nll/issue-50343.rs b/src/test/run-pass/nll/issue-50343.rs
new file mode 100644
index 00000000000..f01d99c68cc
--- /dev/null
+++ b/src/test/run-pass/nll/issue-50343.rs
@@ -0,0 +1,17 @@
+// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(nll)]
+#![deny(unused_mut)]
+
+fn main() {
+    vec![42].iter().map(|_| ()).count();
+    vec![(42, 22)].iter().map(|(_x, _y)| ()).count();
+}