]> git.proxmox.com Git - rustc.git/blob - src/test/debuginfo/generic-struct.rs
New upstream version 1.14.0+dfsg1
[rustc.git] / src / test / debuginfo / generic-struct.rs
1 // Copyright 2013-2014 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 // ignore-tidy-linelength
12 // min-lldb-version: 310
13
14 // compile-flags:-g
15
16 // === GDB TESTS ===================================================================================
17
18 // gdb-command:run
19
20 // gdb-command:print int_int
21 // gdbg-check:$1 = {key = 0, value = 1}
22 // gdbr-check:$1 = generic_struct::AGenericStruct<i32, i32> {key: 0, value: 1}
23 // gdb-command:print int_float
24 // gdbg-check:$2 = {key = 2, value = 3.5}
25 // gdbr-check:$2 = generic_struct::AGenericStruct<i32, f64> {key: 2, value: 3.5}
26 // gdb-command:print float_int
27 // gdbg-check:$3 = {key = 4.5, value = 5}
28 // gdbr-check:$3 = generic_struct::AGenericStruct<f64, i32> {key: 4.5, value: 5}
29 // gdb-command:print float_int_float
30 // gdbg-check:$4 = {key = 6.5, value = {key = 7, value = 8.5}}
31 // gdbr-check:$4 = generic_struct::AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> {key: 6.5, value: generic_struct::AGenericStruct<i32, f64> {key: 7, value: 8.5}}
32
33 // === LLDB TESTS ==================================================================================
34
35 // lldb-command:run
36
37 // lldb-command:print int_int
38 // lldb-check:[...]$0 = AGenericStruct<i32, i32> { key: 0, value: 1 }
39 // lldb-command:print int_float
40 // lldb-check:[...]$1 = AGenericStruct<i32, f64> { key: 2, value: 3.5 }
41 // lldb-command:print float_int
42 // lldb-check:[...]$2 = AGenericStruct<f64, i32> { key: 4.5, value: 5 }
43
44 // lldb-command:print float_int_float
45 // lldb-check:[...]$3 = AGenericStruct<f64, generic_struct::AGenericStruct<i32, f64>> { key: 6.5, value: AGenericStruct<i32, f64> { key: 7, value: 8.5 } }
46
47
48 #![feature(omit_gdb_pretty_printer_section)]
49 #![omit_gdb_pretty_printer_section]
50
51 struct AGenericStruct<TKey, TValue> {
52 key: TKey,
53 value: TValue
54 }
55
56 fn main() {
57
58 let int_int = AGenericStruct { key: 0, value: 1 };
59 let int_float = AGenericStruct { key: 2, value: 3.5f64 };
60 let float_int = AGenericStruct { key: 4.5f64, value: 5 };
61 let float_int_float = AGenericStruct {
62 key: 6.5f64,
63 value: AGenericStruct { key: 7, value: 8.5f64 },
64 };
65
66 zzz(); // #break
67 }
68
69 fn zzz() { () }