diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-02-05 12:45:12 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-02-05 12:45:12 -0500 |
| commit | 4e67bf92e3fb1321325d375933c4c0d2b233fef9 (patch) | |
| tree | 4a166ae2d41de164050e4d4e1178269e365fd359 /src/test | |
| parent | 13b8e4b4161dc0c4587ab8dadc31df252fb492cd (diff) | |
| parent | 7135d0ab944f0bfa5ef4cecfd1dfdd8a79647c53 (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.rs | 8 |
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 + } } |
