1 // Copyright 2015 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.
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.
11 // Matching on a DST struct should not trigger an LLVM assertion.
13 struct Foo<T: ?Sized> {
23 fn get(&self) -> i32 {
28 fn check_val(val: &Foo<[u8]>) {
36 fn check_dst_val(val: &Foo<[u8]>) {
38 Foo { ref inner, .. } => {
39 assert_eq!(inner, [1, 2, 3]);
44 fn check_both(val: &Foo<[u8]>) {
46 Foo { a, ref inner } => {
48 assert_eq!(inner, [1, 2, 3]);
53 fn check_trait_obj(val: &Foo<Get>) {
55 Foo { a, ref inner } => {
57 assert_eq!(inner.get(), 32);
63 let foo: &Foo<[u8]> = &Foo { a: 32, inner: [1, 2, 3] };
68 let foo: &Foo<Get> = &Foo { a: 32, inner: 32 };