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.
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.
11 // min-lldb-version: 310
15 // === GDB TESTS ===================================================================================
18 // gdb-command:print arg
19 // gdbg-check:$1 = {b = -1, b1 = 0}
20 // gdbr-check:$1 = associated_types::Struct<i32> {b: -1, b1: 0}
21 // gdb-command:continue
23 // gdb-command:print inferred
25 // gdb-command:print explicitly
27 // gdb-command:continue
29 // gdb-command:print arg
31 // gdb-command:continue
33 // gdb-command:print arg
34 // gdbg-check:$5 = {__0 = 4, __1 = 5}
35 // gdbr-check:$5 = (4, 5)
36 // gdb-command:continue
38 // gdb-command:print a
40 // gdb-command:print b
42 // gdb-command:continue
44 // gdb-command:print a
46 // gdb-command:print b
48 // gdb-command:continue
50 // === LLDB TESTS ==================================================================================
53 // lldb-command:print arg
54 // lldb-check:[...]$0 = Struct<i32> { b: -1, b1: 0 }
55 // lldb-command:continue
57 // lldb-command:print inferred
58 // lldb-check:[...]$1 = 1
59 // lldb-command:print explicitly
60 // lldb-check:[...]$2 = 1
61 // lldb-command:continue
63 // lldb-command:print arg
64 // lldb-check:[...]$3 = 2
65 // lldb-command:continue
67 // lldb-command:print arg
68 // lldb-check:[...]$4 = (4, 5)
69 // lldb-command:continue
71 // lldb-command:print a
72 // lldb-check:[...]$5 = 6
73 // lldb-command:print b
74 // lldb-check:[...]$6 = 7
75 // lldb-command:continue
77 // lldb-command:print a
78 // lldb-check:[...]$7 = 8
79 // lldb-command:print b
80 // lldb-check:[...]$8 = 9
81 // lldb-command:continue
83 #![allow(unused_variables)]
85 #![feature(omit_gdb_pretty_printer_section)]
86 #![omit_gdb_pretty_printer_section]
88 trait TraitWithAssocType {
91 fn get_value(&self) -> Self::Type;
93 impl TraitWithAssocType for i32 {
96 fn get_value(&self) -> i64 { *self as i64 }
99 struct Struct<T: TraitWithAssocType> {
104 enum Enum<T: TraitWithAssocType> {
105 Variant1(T, T::Type),
109 fn assoc_struct<T: TraitWithAssocType>(arg: Struct<T>) {
113 fn assoc_local<T: TraitWithAssocType>(x: T) {
114 let inferred = x.get_value();
115 let explicitly: T::Type = x.get_value();
120 fn assoc_arg<T: TraitWithAssocType>(arg: T::Type) {
124 fn assoc_return_value<T: TraitWithAssocType>(arg: T) -> T::Type {
125 return arg.get_value();
128 fn assoc_tuple<T: TraitWithAssocType>(arg: (T, T::Type)) {
132 fn assoc_enum<T: TraitWithAssocType>(arg: Enum<T>) {
135 Enum::Variant1(a, b) => {
138 Enum::Variant2(a, b) => {
145 assoc_struct(Struct { b: -1, b1: 0 });
148 assoc_return_value(3);
150 assoc_enum(Enum::Variant1(6, 7));
151 assoc_enum(Enum::Variant2(8, 9));