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-android: FIXME(#10381)
12
+ // min-lldb-version: 310
13
+
14
+ // compile-flags:-g
15
+
16
+ // === GDB TESTS ===================================================================================
17
+ // gdb-command:run
18
+
19
+ // gdb-command:print arg
20
+ // gdb-check:$1 = {b = -1, b1 = 0}
21
+ // gdb-command:continue
22
+
23
+ // gdb-command:print inferred
24
+ // gdb-check:$2 = 1
25
+ // gdb-command:print explicitly
26
+ // gdb-check:$3 = 1
27
+ // gdb-command:continue
28
+
29
+ // gdb-command:print arg
30
+ // gdb-check:$4 = 2
31
+ // gdb-command:continue
32
+
33
+ // gdb-command:print arg
34
+ // gdb-check:$5 = {4, 5}
35
+ // gdb-command:continue
36
+
37
+ // gdb-command:print a
38
+ // gdb-check:$6 = 6
39
+ // gdb-command:print b
40
+ // gdb-check:$7 = 7
41
+ // gdb-command:continue
42
+
43
+ // gdb-command:print a
44
+ // gdb-check:$8 = 8
45
+ // gdb-command:print b
46
+ // gdb-check:$9 = 9
47
+ // gdb-command:continue
48
+
49
+ // === LLDB TESTS ==================================================================================
50
+ // lldb-command:run
51
+
52
+ // lldb-command:print arg
53
+ // lldb-check:[...]$0 = Struct<i32> { b: -1, b1: 0 }
54
+ // lldb-command:continue
55
+
56
+ // lldb-command:print inferred
57
+ // lldb-check:[...]$1 = 1
58
+ // lldb-command:print explicitly
59
+ // lldb-check:[...]$2 = 1
60
+ // lldb-command:continue
61
+
62
+ // lldb-command:print arg
63
+ // lldb-check:[...]$3 = 2
64
+ // lldb-command:continue
65
+
66
+ // lldb-command:print arg
67
+ // lldb-check:[...]$4 = (4, 5)
68
+ // lldb-command:continue
69
+
70
+ // lldb-command:print a
71
+ // lldb-check:[...]$5 = 6
72
+ // lldb-command:print b
73
+ // lldb-check:[...]$6 = 7
74
+ // lldb-command:continue
75
+
76
+ // lldb-command:print a
77
+ // lldb-check:[...]$7 = 8
78
+ // lldb-command:print b
79
+ // lldb-check:[...]$8 = 9
80
+ // lldb-command:continue
81
+
82
+ #![ allow( unused_variables) ]
83
+ #![ allow( dead_code) ]
84
+ #![ omit_gdb_pretty_printer_section]
85
+
86
+ trait TraitWithAssocType {
87
+ type Type ;
88
+
89
+ fn get_value ( & self ) -> Self :: Type ;
90
+ }
91
+ impl TraitWithAssocType for i32 {
92
+ type Type = i64 ;
93
+
94
+ fn get_value ( & self ) -> i64 { * self as i64 }
95
+ }
96
+
97
+ struct Struct < T : TraitWithAssocType > {
98
+ b : T ,
99
+ b1 : T :: Type ,
100
+ }
101
+
102
+ enum Enum < T : TraitWithAssocType > {
103
+ Variant1 ( T , T :: Type ) ,
104
+ Variant2 ( T :: Type , T )
105
+ }
106
+
107
+ fn assoc_struct < T : TraitWithAssocType > ( arg : Struct < T > ) {
108
+ zzz ( ) ; // #break
109
+ }
110
+
111
+ fn assoc_local < T : TraitWithAssocType > ( x : T ) {
112
+ let inferred = x. get_value ( ) ;
113
+ let explicitly: T :: Type = x. get_value ( ) ;
114
+
115
+ zzz ( ) ; // #break
116
+ }
117
+
118
+ fn assoc_arg < T : TraitWithAssocType > ( arg : T :: Type ) {
119
+ zzz ( ) ; // #break
120
+ }
121
+
122
+ fn assoc_return_value < T : TraitWithAssocType > ( arg : T ) -> T :: Type {
123
+ return arg. get_value ( ) ;
124
+ }
125
+
126
+ fn assoc_tuple < T : TraitWithAssocType > ( arg : ( T , T :: Type ) ) {
127
+ zzz ( ) ; // #break
128
+ }
129
+
130
+ fn assoc_enum < T : TraitWithAssocType > ( arg : Enum < T > ) {
131
+
132
+ match arg {
133
+ Enum :: Variant1 ( a, b) => {
134
+ zzz ( ) ; // #break
135
+ }
136
+ Enum :: Variant2 ( a, b) => {
137
+ zzz ( ) ; // #break
138
+ }
139
+ }
140
+ }
141
+
142
+ fn main ( ) {
143
+ assoc_struct ( Struct { b : -1i32 , b1 : 0i64 } ) ;
144
+ assoc_local ( 1i32 ) ;
145
+ assoc_arg :: < i32 > ( 2i64 ) ;
146
+ assoc_return_value ( 3i32 ) ;
147
+ assoc_tuple ( ( 4i32 , 5i64 ) ) ;
148
+ assoc_enum ( Enum :: Variant1 ( 6i32 , 7i64 ) ) ;
149
+ assoc_enum ( Enum :: Variant2 ( 8i64 , 9i32 ) ) ;
150
+ }
151
+
152
+ fn zzz ( ) { ( ) }
0 commit comments