]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/unsized.rs
Rollup merge of #56476 - GuillaumeGomez:invalid-line-number-match, r=QuietMisdreavus
[rust.git] / src / test / debuginfo / unsized.rs
1 // Copyright 2016 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 // compile-flags:-g
12
13 // === GDB TESTS ===================================================================================
14
15 // gdb-command:run
16
17 // gdb-command:print *a
18 // gdbg-check:$1 = {value = [...] "abc"}
19 // gdbr-check:$1 = unsized::Foo<[u8]> {value: [...]}
20
21 // gdb-command:print *b
22 // gdbg-check:$2 = {value = {value = [...] "abc"}}
23 // gdbr-check:$2 = unsized::Foo<unsized::Foo<[u8]>> {value: unsized::Foo<[u8]> {value: [...]}}
24
25
26 #![feature(omit_gdb_pretty_printer_section)]
27 #![omit_gdb_pretty_printer_section]
28
29 struct Foo<T: ?Sized> {
30     value: T
31 }
32
33 fn main() {
34     let foo: Foo<Foo<[u8; 4]>> = Foo {
35         value: Foo {
36             value: *b"abc\0"
37         }
38     };
39     let a: &Foo<[u8]> = &foo.value;
40     let b: &Foo<Foo<[u8]>> = &foo;
41
42     zzz(); // #break
43 }
44
45 fn zzz() { () }