2016-12-22 21:13:33 +10:00
|
|
|
// compile-flags:-g
|
|
|
|
|
|
|
|
// === GDB TESTS ===================================================================================
|
|
|
|
|
|
|
|
// gdb-command:run
|
|
|
|
|
2022-01-13 18:13:54 +01:00
|
|
|
// gdb-command:print a
|
2022-01-25 12:14:17 +01:00
|
|
|
// gdbg-check:$1 = {data_ptr = [...], length = 4}
|
2022-01-13 18:13:54 +01:00
|
|
|
// gdbr-check:$1 = &unsized::Foo<[u8]> {data_ptr: [...], length: 4}
|
2016-12-22 21:13:33 +10:00
|
|
|
|
2022-01-13 18:13:54 +01:00
|
|
|
// gdb-command:print b
|
2022-01-25 12:14:17 +01:00
|
|
|
// gdbg-check:$2 = {data_ptr = [...], length = 4}
|
2022-01-13 18:13:54 +01:00
|
|
|
// gdbr-check:$2 = &unsized::Foo<unsized::Foo<[u8]>> {data_ptr: [...], length: 4}
|
|
|
|
|
|
|
|
// gdb-command:print c
|
2022-01-25 12:14:17 +01:00
|
|
|
// gdbg-check:$3 = {pointer = [...], vtable = [...]}
|
2022-01-13 18:13:54 +01:00
|
|
|
// gdbr-check:$3 = &unsized::Foo<dyn core::fmt::Debug> {pointer: [...], vtable: [...]}
|
|
|
|
|
|
|
|
// === CDB TESTS ===================================================================================
|
|
|
|
|
|
|
|
// cdb-command: g
|
|
|
|
// cdb-command:dx a
|
|
|
|
// cdb-check:a [Type: ref$<unsized::Foo<slice$<u8> > >]
|
|
|
|
// cdb-check: [+0x000] data_ptr : 0x[...] [Type: unsized::Foo<slice$<u8> > *]
|
2022-01-25 12:14:17 +01:00
|
|
|
// cdb-check: [...] length : 0x4 [Type: unsigned [...]int[...]
|
2022-01-13 18:13:54 +01:00
|
|
|
|
|
|
|
// cdb-command:dx b
|
|
|
|
// cdb-check:b [Type: ref$<unsized::Foo<unsized::Foo<slice$<u8> > > >]
|
|
|
|
// cdb-check: [+0x000] data_ptr : 0x[...] [Type: unsized::Foo<unsized::Foo<slice$<u8> > > *]
|
2022-01-25 12:14:17 +01:00
|
|
|
// cdb-check: [...] length : 0x4 [Type: unsigned [...]int[...]
|
2022-01-13 18:13:54 +01:00
|
|
|
|
|
|
|
// cdb-command:dx c
|
|
|
|
// cdb-check:c [Type: ref$<unsized::Foo<dyn$<core::fmt::Debug> > >]
|
|
|
|
// cdb-check: [+0x000] pointer : 0x[...] [Type: unsized::Foo<dyn$<core::fmt::Debug> > *]
|
2022-01-25 12:14:17 +01:00
|
|
|
// cdb-check: [...] vtable : 0x[...] [Type: unsigned [...]int[...] (*)[3]]
|
2016-12-22 21:13:33 +10:00
|
|
|
|
|
|
|
#![feature(omit_gdb_pretty_printer_section)]
|
|
|
|
#![omit_gdb_pretty_printer_section]
|
|
|
|
|
|
|
|
struct Foo<T: ?Sized> {
|
2022-01-25 12:14:17 +01:00
|
|
|
value: T,
|
2016-12-22 21:13:33 +10:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2022-01-25 12:14:17 +01:00
|
|
|
let foo: Foo<Foo<[u8; 4]>> = Foo { value: Foo { value: *b"abc\0" } };
|
2022-01-13 18:13:54 +01:00
|
|
|
|
|
|
|
// We expect `a`, `b`, and `c` to all be fat pointers.
|
|
|
|
// `a` and `b` should be slice-like and thus have a `data_ptr` and `length` field.
|
|
|
|
// `c` should be trait-object-like and thus have a `pointer` and `vtable` field.
|
2016-12-22 21:13:33 +10:00
|
|
|
let a: &Foo<[u8]> = &foo.value;
|
|
|
|
let b: &Foo<Foo<[u8]>> = &foo;
|
2022-01-13 18:13:54 +01:00
|
|
|
let c: &Foo<dyn std::fmt::Debug> = &Foo { value: 7i32 };
|
2016-12-22 21:13:33 +10:00
|
|
|
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
2022-01-25 12:14:17 +01:00
|
|
|
fn zzz() {
|
|
|
|
()
|
|
|
|
}
|