diff --git a/src/test/run-pass/issue-8351-1.rs b/src/test/run-pass/issue-8351-1.rs new file mode 100644 index 000000000000..44e100576e22 --- /dev/null +++ b/src/test/run-pass/issue-8351-1.rs @@ -0,0 +1,25 @@ +// Copyright 2013 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. + +#[feature(struct_variant)]; + +enum E { + Foo{f: int}, + Bar, +} + +pub fn main() { + let e = Foo{f: 0}; + match e { + Foo{f: 1} => fail2!(), + Foo{_} => (), + _ => fail2!(), + } +} diff --git a/src/test/run-pass/issue-8351-2.rs b/src/test/run-pass/issue-8351-2.rs new file mode 100644 index 000000000000..4c3192189533 --- /dev/null +++ b/src/test/run-pass/issue-8351-2.rs @@ -0,0 +1,25 @@ +// Copyright 2013 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. + +#[feature(struct_variant)]; + +enum E { + Foo{f: int, b: bool}, + Bar, +} + +pub fn main() { + let e = Foo{f: 0, b: false}; + match e { + Foo{f: 1, b: true} => fail2!(), + Foo{b: false, f: 0} => (), + _ => fail2!(), + } +}