]> git.proxmox.com Git - rustc.git/blob - src/test/run-pass/issue-14308.rs
Imported Upstream version 1.0.0~beta.3
[rustc.git] / src / test / run-pass / issue-14308.rs
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
11
12 struct A(isize);
13 struct B;
14
15 fn main() {
16 let x = match A(3) {
17 A(..) => 1
18 };
19 assert_eq!(x, 1);
20 let x = match A(4) {
21 A(1) => 1,
22 A(..) => 2
23 };
24 assert_eq!(x, 2);
25
26 // This next test uses a (..) wildcard match on a nullary struct.
27 // There's no particularly good reason to support this, but it's currently allowed,
28 // and this makes sure it doesn't ICE or break LLVM.
29 let x = match B {
30 B(..) => 3
31 };
32 assert_eq!(x, 3);
33 }