]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/issue22656.rs
Auto merge of #28816 - petrochenkov:unistruct, r=nrc
[rust.git] / src / test / debuginfo / issue22656.rs
1 // Copyright 2013-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.
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 // This test makes sure that the LLDB pretty printer does not throw an exception
13 // when trying to handle a Vec<> or anything else that contains zero-sized
14 // fields.
15
16 // min-lldb-version: 310
17 // ignore-gdb
18 // ignore-tidy-linelength
19
20 // compile-flags:-g
21
22 // === LLDB TESTS ==================================================================================
23 // lldb-command:run
24
25 // lldb-command:print v
26 // lldb-check:[...]$0 = vec![1, 2, 3]
27 // lldb-command:print zs
28 // lldb-check:[...]$1 = StructWithZeroSizedField { x: ZeroSizedStruct, y: 123, z: ZeroSizedStruct, w: 456 }
29 // lldb-command:continue
30
31 #![allow(unused_variables)]
32 #![allow(dead_code)]
33 #![feature(omit_gdb_pretty_printer_section)]
34 #![omit_gdb_pretty_printer_section]
35
36 struct ZeroSizedStruct;
37
38 struct StructWithZeroSizedField {
39     x: ZeroSizedStruct,
40     y: u32,
41     z: ZeroSizedStruct,
42     w: u64
43 }
44
45 fn main() {
46     let v = vec![1,2,3];
47
48     let zs = StructWithZeroSizedField {
49         x: ZeroSizedStruct,
50         y: 123,
51         z: ZeroSizedStruct,
52         w: 456
53     };
54
55     zzz(); // #break
56 }
57
58 fn zzz() { () }