diff options
| author | Jakub Wieczorek <jakub@jakub.cc> | 2014-07-03 22:53:20 +0200 |
|---|---|---|
| committer | Jakub Wieczorek <jakub@jakub.cc> | 2014-07-04 00:29:47 +0200 |
| commit | c2c27faa35212eea653c7095cca6817be6c48fb1 (patch) | |
| tree | 843fbaf895f37e358a0e6d08cc69b1edac18444d /src/test/run-pass | |
| parent | eda75bcf42ad99e3e4c99585d39705fccac606ee (diff) | |
| download | rust-c2c27faa35212eea653c7095cca6817be6c48fb1.tar.gz rust-c2c27faa35212eea653c7095cca6817be6c48fb1.zip | |
Fix #12285
Unit-like struct patterns are irrefutable, no need for a branch.
Diffstat (limited to 'src/test/run-pass')
| -rw-r--r-- | src/test/run-pass/issue-12285.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/run-pass/issue-12285.rs b/src/test/run-pass/issue-12285.rs new file mode 100644 index 00000000000..563771212aa --- /dev/null +++ b/src/test/run-pass/issue-12285.rs @@ -0,0 +1,22 @@ +// Copyright 2014 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. + +struct S; + +fn main() { + match Some(&S) { + Some(&S) => {}, + _x => unreachable!() + } + match Some(&S) { + Some(&S) => {}, + None => unreachable!() + } +} |
