2018-10-12 08:34:14 -05:00
|
|
|
// Some versions of the non-rust-enabled LLDB print the wrong generic
|
|
|
|
// parameter type names in this test.
|
2023-04-14 04:40:07 -05:00
|
|
|
// needs-rust-lldb
|
2015-01-21 10:10:02 -06:00
|
|
|
|
|
|
|
// compile-flags:-g
|
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
// gdb-command:run
|
|
|
|
|
|
|
|
// gdb-command:print arg
|
2016-10-25 16:32:04 -05:00
|
|
|
// gdbg-check:$1 = {b = -1, b1 = 0}
|
|
|
|
// gdbr-check:$1 = associated_types::Struct<i32> {b: -1, b1: 0}
|
2015-01-21 10:10:02 -06:00
|
|
|
// gdb-command:continue
|
|
|
|
|
|
|
|
// gdb-command:print inferred
|
|
|
|
// gdb-check:$2 = 1
|
|
|
|
// gdb-command:print explicitly
|
|
|
|
// gdb-check:$3 = 1
|
|
|
|
// gdb-command:continue
|
|
|
|
|
|
|
|
// gdb-command:print arg
|
|
|
|
// gdb-check:$4 = 2
|
|
|
|
// gdb-command:continue
|
|
|
|
|
|
|
|
// gdb-command:print arg
|
2016-10-25 16:32:04 -05:00
|
|
|
// gdbg-check:$5 = {__0 = 4, __1 = 5}
|
|
|
|
// gdbr-check:$5 = (4, 5)
|
2015-01-21 10:10:02 -06:00
|
|
|
// gdb-command:continue
|
|
|
|
|
|
|
|
// gdb-command:print a
|
|
|
|
// gdb-check:$6 = 6
|
|
|
|
// gdb-command:print b
|
|
|
|
// gdb-check:$7 = 7
|
|
|
|
// gdb-command:continue
|
|
|
|
|
|
|
|
// gdb-command:print a
|
|
|
|
// gdb-check:$8 = 8
|
|
|
|
// gdb-command:print b
|
|
|
|
// gdb-check:$9 = 9
|
|
|
|
// gdb-command:continue
|
|
|
|
|
|
|
|
// === LLDB TESTS ==================================================================================
|
|
|
|
// lldb-command:run
|
|
|
|
|
|
|
|
// lldb-command:print arg
|
2019-05-14 07:50:58 -05:00
|
|
|
// lldbg-check:[...]$0 = { b = -1, b1 = 0 }
|
|
|
|
// lldbr-check:(associated_types::Struct<i32>) arg = { b = -1, b1 = 0 }
|
2015-01-21 10:10:02 -06:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// lldb-command:print inferred
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$1 = 1
|
|
|
|
// lldbr-check:(i64) inferred = 1
|
2015-01-21 10:10:02 -06:00
|
|
|
// lldb-command:print explicitly
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$2 = 1
|
|
|
|
// lldbr-check:(i64) explicitly = 1
|
2015-01-21 10:10:02 -06:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// lldb-command:print arg
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$3 = 2
|
|
|
|
// lldbr-check:(i64) arg = 2
|
2015-01-21 10:10:02 -06:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// lldb-command:print arg
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$4 = (4, 5)
|
|
|
|
// lldbr-check:((i32, i64)) arg = { = 4 = 5 }
|
2015-01-21 10:10:02 -06:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// lldb-command:print a
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$5 = 6
|
|
|
|
// lldbr-check:(i32) a = 6
|
2015-01-21 10:10:02 -06:00
|
|
|
// lldb-command:print b
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$6 = 7
|
|
|
|
// lldbr-check:(i64) b = 7
|
2015-01-21 10:10:02 -06:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
// lldb-command:print a
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$7 = 8
|
|
|
|
// lldbr-check:(i64) a = 8
|
2015-01-21 10:10:02 -06:00
|
|
|
// lldb-command:print b
|
2018-10-02 11:13:30 -05:00
|
|
|
// lldbg-check:[...]$8 = 9
|
|
|
|
// lldbr-check:(i32) b = 9
|
2015-01-21 10:10:02 -06:00
|
|
|
// lldb-command:continue
|
|
|
|
|
|
|
|
#![allow(unused_variables)]
|
|
|
|
#![allow(dead_code)]
|
2016-04-14 09:17:37 -05:00
|
|
|
#![feature(omit_gdb_pretty_printer_section)]
|
2015-01-21 10:10:02 -06:00
|
|
|
#![omit_gdb_pretty_printer_section]
|
|
|
|
|
|
|
|
trait TraitWithAssocType {
|
|
|
|
type Type;
|
|
|
|
|
|
|
|
fn get_value(&self) -> Self::Type;
|
|
|
|
}
|
|
|
|
impl TraitWithAssocType for i32 {
|
|
|
|
type Type = i64;
|
|
|
|
|
|
|
|
fn get_value(&self) -> i64 { *self as i64 }
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Struct<T: TraitWithAssocType> {
|
|
|
|
b: T,
|
|
|
|
b1: T::Type,
|
|
|
|
}
|
|
|
|
|
|
|
|
enum Enum<T: TraitWithAssocType> {
|
|
|
|
Variant1(T, T::Type),
|
|
|
|
Variant2(T::Type, T)
|
|
|
|
}
|
|
|
|
|
|
|
|
fn assoc_struct<T: TraitWithAssocType>(arg: Struct<T>) {
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn assoc_local<T: TraitWithAssocType>(x: T) {
|
|
|
|
let inferred = x.get_value();
|
|
|
|
let explicitly: T::Type = x.get_value();
|
|
|
|
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn assoc_arg<T: TraitWithAssocType>(arg: T::Type) {
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn assoc_return_value<T: TraitWithAssocType>(arg: T) -> T::Type {
|
|
|
|
return arg.get_value();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn assoc_tuple<T: TraitWithAssocType>(arg: (T, T::Type)) {
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn assoc_enum<T: TraitWithAssocType>(arg: Enum<T>) {
|
|
|
|
|
|
|
|
match arg {
|
|
|
|
Enum::Variant1(a, b) => {
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
Enum::Variant2(a, b) => {
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2015-03-03 02:42:26 -06:00
|
|
|
assoc_struct(Struct { b: -1, b1: 0 });
|
|
|
|
assoc_local(1);
|
|
|
|
assoc_arg::<i32>(2);
|
|
|
|
assoc_return_value(3);
|
|
|
|
assoc_tuple((4, 5));
|
|
|
|
assoc_enum(Enum::Variant1(6, 7));
|
|
|
|
assoc_enum(Enum::Variant2(8, 9));
|
2015-01-21 10:10:02 -06:00
|
|
|
}
|
|
|
|
|
2015-01-29 16:03:36 -06:00
|
|
|
fn zzz() { () }
|