about summary refs log tree commit diff
path: root/src/test/run-pass/allow_irrefutable_let_patterns.rs
diff options
context:
space:
mode:
authorSebastian Malton <sebastian@malton.name>2018-06-03 23:31:49 -0400
committerJake Goulding <jake.goulding@gmail.com>2018-06-05 10:19:21 -0400
commit4fe40635ef3c2cdbc2e3f62ca71f0e2235e70639 (patch)
tree94089961baf76e9fd6ad1ce82c65de281bc74c52 /src/test/run-pass/allow_irrefutable_let_patterns.rs
parent4122885e0f99b3f28e65c122cde48de5bfc8231a (diff)
Implementation of RFC 2086 - Allow Irrefutable Let patterns
Diffstat (limited to 'src/test/run-pass/allow_irrefutable_let_patterns.rs')
-rw-r--r--src/test/run-pass/allow_irrefutable_let_patterns.rs22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/run-pass/allow_irrefutable_let_patterns.rs b/src/test/run-pass/allow_irrefutable_let_patterns.rs
new file mode 100644
index 00000000000..3a4f226dfe6
--- /dev/null
+++ b/src/test/run-pass/allow_irrefutable_let_patterns.rs
@@ -0,0 +1,22 @@
+// Copyright 2015 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(irrefutable_let_pattern)]
+
+// must-compile-successfully-irrefutable_let_pattern_with_gate
+fn main() {
+    #[allow(irrefutable_let_pattern)]
+    if let _ = 5 {}
+
+    #[allow(irrefutable_let_pattern)]
+    while let _ = 5 {
+        break;
+    }
+}