2024-02-22 06:10:29 -06:00
|
|
|
//@ only-cdb
|
|
|
|
//@ compile-flags: -g
|
2021-09-01 15:31:35 -05:00
|
|
|
|
|
|
|
// cdb-command: g
|
|
|
|
|
|
|
|
// cdb-command: dx r1
|
|
|
|
// cdb-check:r1 : (0xa..0xc) [Type: core::ops::range::Range<u32>]
|
|
|
|
// cdb-command: dx r2
|
2021-09-01 14:56:32 -05:00
|
|
|
// cdb-check:r2 : (0x14..0x1e) [Type: core::ops::range::Range<u64>]
|
2021-09-01 15:31:35 -05:00
|
|
|
|
|
|
|
// cdb-command: g
|
|
|
|
|
|
|
|
// cdb-command: dx r1
|
|
|
|
// cdb-check:r1 : (0x9..0x64) [Type: core::ops::range::Range<u32>]
|
|
|
|
// cdb-command: dx r2
|
2021-09-01 14:56:32 -05:00
|
|
|
// cdb-check:r2 : (0xc..0x5a) [Type: core::ops::range::Range<u64>]
|
2021-09-01 15:31:35 -05:00
|
|
|
|
|
|
|
// cdb-command: g
|
|
|
|
|
|
|
|
// cdb-command: dx o1
|
2022-07-07 08:01:43 -05:00
|
|
|
// cdb-check:o1 : Some [Type: enum2$<core::option::Option<u32> >]
|
2021-09-01 15:31:35 -05:00
|
|
|
// cdb-check: [+0x004] __0 : 0x4d2 [Type: [...]]
|
|
|
|
// cdb-command: dx o2
|
2022-07-07 08:01:43 -05:00
|
|
|
// cdb-check:o2 : Some [Type: enum2$<core::option::Option<u64> >]
|
2021-09-01 14:56:32 -05:00
|
|
|
// cdb-check: [+0x008] __0 : 0x162e [Type: unsigned __int64]
|
2021-09-01 15:31:35 -05:00
|
|
|
|
|
|
|
// cdb-command: g
|
|
|
|
|
|
|
|
// cdb-command: dx t1
|
|
|
|
// cdb-check:t1 : (0xa, 0x14) [Type: tuple$<u32,u32>]
|
|
|
|
// cdb-check: [0] : 0xa [Type: unsigned int]
|
|
|
|
// cdb-check: [1] : 0x14 [Type: unsigned int]
|
|
|
|
// cdb-command: dx t2
|
2021-09-01 14:56:32 -05:00
|
|
|
// cdb-check:t2 : (0x1e, 0x28) [Type: tuple$<u64,u64>]
|
|
|
|
// cdb-check: [0] : 0x1e [Type: unsigned __int64]
|
|
|
|
// cdb-check: [1] : 0x28 [Type: unsigned __int64]
|
2021-09-01 15:31:35 -05:00
|
|
|
|
|
|
|
// cdb-command: g
|
|
|
|
|
|
|
|
// cdb-command: dx s
|
[debuginfo] Make debuginfo type names for slices and str consistent.
Before this PR, the compiler would emit the debuginfo name `slice$<T>`
for all kinds of slices, regardless of whether they are behind a
reference or not and regardless of the kind of reference. As a
consequence, the types `Foo<&[T]>`, `Foo<[T]>`, and `Foo<&mut [T]>`
would end up with the same type name `Foo<slice$<T> >` in debuginfo,
making it impossible to disambiguate between them by name. Similarly,
`&str` would get the name `str` in debuginfo, so the debuginfo name for
`Foo<str>` and `Foo<&str>` would be the same. In contrast,
`*const [bool]` and `*mut [bool]` would be `ptr_const$<slice$<bool> >`
and `ptr_mut$<slice$<bool> >`, i.e. the encoding does not lose
information about the type.
This PR removes all special handling for slices and `str`. The types
`&[bool]`, `&mut [bool]`, and `&str` thus get the names
`ref$<slice2$<bool> >`, `ref_mut$<slice2$<bool> >`, and
`ref$<str$>` respectively -- as one would expect.
2022-10-25 05:28:03 -05:00
|
|
|
// cdb-check:s : "this is a static str" [Type: ref$<str$>]
|
2021-09-01 14:56:32 -05:00
|
|
|
// cdb-check: [len] : 0x14 [Type: unsigned [...]]
|
2021-09-01 15:31:35 -05:00
|
|
|
// cdb-check: [chars]
|
|
|
|
|
|
|
|
// cdb-command: g
|
|
|
|
|
|
|
|
// cdb-command: dx s
|
[debuginfo] Make debuginfo type names for slices and str consistent.
Before this PR, the compiler would emit the debuginfo name `slice$<T>`
for all kinds of slices, regardless of whether they are behind a
reference or not and regardless of the kind of reference. As a
consequence, the types `Foo<&[T]>`, `Foo<[T]>`, and `Foo<&mut [T]>`
would end up with the same type name `Foo<slice$<T> >` in debuginfo,
making it impossible to disambiguate between them by name. Similarly,
`&str` would get the name `str` in debuginfo, so the debuginfo name for
`Foo<str>` and `Foo<&str>` would be the same. In contrast,
`*const [bool]` and `*mut [bool]` would be `ptr_const$<slice$<bool> >`
and `ptr_mut$<slice$<bool> >`, i.e. the encoding does not lose
information about the type.
This PR removes all special handling for slices and `str`. The types
`&[bool]`, `&mut [bool]`, and `&str` thus get the names
`ref$<slice2$<bool> >`, `ref_mut$<slice2$<bool> >`, and
`ref$<str$>` respectively -- as one would expect.
2022-10-25 05:28:03 -05:00
|
|
|
// cdb-check:s : { len=0x5 } [Type: ref$<slice2$<u8> >]
|
2021-09-01 14:56:32 -05:00
|
|
|
// cdb-check: [len] : 0x5 [Type: unsigned [...]]
|
2021-09-01 15:31:35 -05:00
|
|
|
// cdb-check: [0] : 0x1 [Type: unsigned char]
|
|
|
|
// cdb-check: [1] : 0x2 [Type: unsigned char]
|
|
|
|
// cdb-check: [2] : 0x3 [Type: unsigned char]
|
|
|
|
// cdb-check: [3] : 0x4 [Type: unsigned char]
|
|
|
|
// cdb-check: [4] : 0x5 [Type: unsigned char]
|
|
|
|
|
|
|
|
use std::ops::Range;
|
|
|
|
|
|
|
|
fn range(r1: Range<u32>, r2: Range<u64>) {
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn range_mut(mut r1: Range<u32>, mut r2: Range<u64>) {
|
|
|
|
if r1.start == 9 {
|
|
|
|
r1.end = 100;
|
|
|
|
}
|
|
|
|
|
|
|
|
if r2.start == 12 {
|
|
|
|
r2.end = 90;
|
|
|
|
}
|
|
|
|
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn option(o1: Option<u32>, o2: Option<u64>) {
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn tuple(t1: (u32, u32), t2: (u64, u64)) {
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn str(s: &str) {
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
|
|
|
fn slice(s: &[u8]) {
|
|
|
|
zzz(); // #break
|
|
|
|
}
|
|
|
|
|
2022-06-20 10:50:27 -05:00
|
|
|
fn zzz() {}
|
2021-09-01 15:31:35 -05:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
range(10..12, 20..30);
|
|
|
|
range_mut(9..20, 12..80);
|
|
|
|
option(Some(1234), Some(5678));
|
|
|
|
tuple((10, 20), (30, 40));
|
|
|
|
str("this is a static str");
|
|
|
|
slice(&[1, 2, 3, 4, 5]);
|
|
|
|
}
|