]> git.proxmox.com Git - rustc.git/blame - src/test/run-pass/issue-14308.rs
Imported Upstream version 1.0.0~beta
[rustc.git] / src / test / run-pass / issue-14308.rs
CommitLineData
1a4d82fc
JJ
1// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2// file at the top-level directory of this distribution and at
3// http://rust-lang.org/COPYRIGHT.
4//
5// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8// option. This file may not be copied, modified, or distributed
9// except according to those terms.
10
c34b1796
AL
11// pretty-expanded FIXME #23616
12
13struct A(isize);
1a4d82fc
JJ
14struct B;
15
16fn main() {
17 let x = match A(3) {
85aaf69f 18 A(..) => 1
1a4d82fc
JJ
19 };
20 assert_eq!(x, 1);
21 let x = match A(4) {
85aaf69f
SL
22 A(1) => 1,
23 A(..) => 2
1a4d82fc
JJ
24 };
25 assert_eq!(x, 2);
26
27 // This next test uses a (..) wildcard match on a nullary struct.
28 // There's no particularly good reason to support this, but it's currently allowed,
29 // and this makes sure it doesn't ICE or break LLVM.
30 let x = match B {
85aaf69f 31 B(..) => 3
1a4d82fc
JJ
32 };
33 assert_eq!(x, 3);
34}