1 // Some versions of the non-rust-enabled LLDB print the wrong generic
2 // parameter type names in this test.
7 // === GDB TESTS ===================================================================================
10 // gdb-command:print arg
11 // gdbg-check:$1 = {b = -1, b1 = 0}
12 // gdbr-check:$1 = associated_types::Struct<i32> {b: -1, b1: 0}
13 // gdb-command:continue
15 // gdb-command:print inferred
17 // gdb-command:print explicitly
19 // gdb-command:continue
21 // gdb-command:print arg
23 // gdb-command:continue
25 // gdb-command:print arg
26 // gdbg-check:$5 = {__0 = 4, __1 = 5}
27 // gdbr-check:$5 = (4, 5)
28 // gdb-command:continue
30 // gdb-command:print a
32 // gdb-command:print b
34 // gdb-command:continue
36 // gdb-command:print a
38 // gdb-command:print b
40 // gdb-command:continue
42 // === LLDB TESTS ==================================================================================
45 // lldb-command:print arg
46 // lldbg-check:[...]$0 = { b = -1, b1 = 0 }
47 // lldbr-check:(associated_types::Struct<i32>) arg = { b = -1, b1 = 0 }
48 // lldb-command:continue
50 // lldb-command:print inferred
51 // lldbg-check:[...]$1 = 1
52 // lldbr-check:(i64) inferred = 1
53 // lldb-command:print explicitly
54 // lldbg-check:[...]$2 = 1
55 // lldbr-check:(i64) explicitly = 1
56 // lldb-command:continue
58 // lldb-command:print arg
59 // lldbg-check:[...]$3 = 2
60 // lldbr-check:(i64) arg = 2
61 // lldb-command:continue
63 // lldb-command:print arg
64 // lldbg-check:[...]$4 = (4, 5)
65 // lldbr-check:((i32, i64)) arg = { = 4 = 5 }
66 // lldb-command:continue
68 // lldb-command:print a
69 // lldbg-check:[...]$5 = 6
70 // lldbr-check:(i32) a = 6
71 // lldb-command:print b
72 // lldbg-check:[...]$6 = 7
73 // lldbr-check:(i64) b = 7
74 // lldb-command:continue
76 // lldb-command:print a
77 // lldbg-check:[...]$7 = 8
78 // lldbr-check:(i64) a = 8
79 // lldb-command:print b
80 // lldbg-check:[...]$8 = 9
81 // lldbr-check:(i32) b = 9
82 // lldb-command:continue
84 #![allow(unused_variables)]
86 #![feature(omit_gdb_pretty_printer_section)]
87 #![omit_gdb_pretty_printer_section]
89 trait TraitWithAssocType {
92 fn get_value(&self) -> Self::Type;
94 impl TraitWithAssocType for i32 {
97 fn get_value(&self) -> i64 { *self as i64 }
100 struct Struct<T: TraitWithAssocType> {
105 enum Enum<T: TraitWithAssocType> {
106 Variant1(T, T::Type),
110 fn assoc_struct<T: TraitWithAssocType>(arg: Struct<T>) {
114 fn assoc_local<T: TraitWithAssocType>(x: T) {
115 let inferred = x.get_value();
116 let explicitly: T::Type = x.get_value();
121 fn assoc_arg<T: TraitWithAssocType>(arg: T::Type) {
125 fn assoc_return_value<T: TraitWithAssocType>(arg: T) -> T::Type {
126 return arg.get_value();
129 fn assoc_tuple<T: TraitWithAssocType>(arg: (T, T::Type)) {
133 fn assoc_enum<T: TraitWithAssocType>(arg: Enum<T>) {
136 Enum::Variant1(a, b) => {
139 Enum::Variant2(a, b) => {
146 assoc_struct(Struct { b: -1, b1: 0 });
149 assoc_return_value(3);
151 assoc_enum(Enum::Variant1(6, 7));
152 assoc_enum(Enum::Variant2(8, 9));