From c2c27faa35212eea653c7095cca6817be6c48fb1 Mon Sep 17 00:00:00 2001 From: Jakub Wieczorek Date: Thu, 3 Jul 2014 22:53:20 +0200 Subject: Fix #12285 Unit-like struct patterns are irrefutable, no need for a branch. --- src/test/run-pass/issue-12285.rs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/test/run-pass/issue-12285.rs (limited to 'src/test') 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 or the MIT license +// , 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!() + } +} -- cgit 1.4.1-3-g733a5