about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-02-05 12:45:12 -0500
committerGitHub <noreply@github.com>2017-02-05 12:45:12 -0500
commit4e67bf92e3fb1321325d375933c4c0d2b233fef9 (patch)
tree4a166ae2d41de164050e4d4e1178269e365fd359 /src/test
parent13b8e4b4161dc0c4587ab8dadc31df252fb492cd (diff)
parent7135d0ab944f0bfa5ef4cecfd1dfdd8a79647c53 (diff)
Rollup merge of #39526 - canndrew:uninhabited-while-let-fix, r=arielb1
Uninhabited while-let pattern fix

This fix makes it so while-let with an unsatisfiable pattern raises a correct warning rather than an incorrect error.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/compile-fail/uninhabited-patterns.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/test/compile-fail/uninhabited-patterns.rs b/src/test/compile-fail/uninhabited-patterns.rs
index 0de29f3a8d7..4c894b0bdd3 100644
--- a/src/test/compile-fail/uninhabited-patterns.rs
+++ b/src/test/compile-fail/uninhabited-patterns.rs
@@ -24,6 +24,10 @@ struct NotSoSecretlyEmpty {
     _priv: !,
 }
 
+fn foo() -> Option<NotSoSecretlyEmpty> {
+    None
+}
+
 fn main() {
     let x: &[!] = &[];
 
@@ -45,5 +49,9 @@ fn main() {
         Err(Err(_y)) => (),
         Err(Ok(_y)) => (),  //~ ERROR unreachable pattern
     }
+
+    while let Some(_y) = foo() {
+        //~^ ERROR unreachable pattern
+    }
 }