]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/issue-22656.rs
6c3988b127ec21ac05aff709c0835e4efed3e1a0
[rust.git] / src / test / debuginfo / issue-22656.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 // lldbg-check:[...]$0 = vec![1, 2, 3]
27 // lldbr-check:(alloc::vec::Vec<i32>) v = vec![1, 2, 3]
28 // lldb-command:print zs
29 // lldbg-check:[...]$1 = StructWithZeroSizedField { x: ZeroSizedStruct, y: 123, z: ZeroSizedStruct, w: 456 }
30 // lldbr-check:(issue_22656::StructWithZeroSizedField) zs = StructWithZeroSizedField { x: ZeroSizedStruct { }, y: 123, z: ZeroSizedStruct { }, w: 456 }
31 // lldbr-command:continue
32
33 #![allow(unused_variables)]
34 #![allow(dead_code)]
35 #![feature(omit_gdb_pretty_printer_section)]
36 #![omit_gdb_pretty_printer_section]
37
38 struct ZeroSizedStruct;
39
40 struct StructWithZeroSizedField {
41     x: ZeroSizedStruct,
42     y: u32,
43     z: ZeroSizedStruct,
44     w: u64
45 }
46
47 fn main() {
48     let v = vec![1,2,3];
49
50     let zs = StructWithZeroSizedField {
51         x: ZeroSizedStruct,
52         y: 123,
53         z: ZeroSizedStruct,
54         w: 456
55     };
56
57     zzz(); // #break
58 }
59
60 fn zzz() { () }