2021-03-30 12:43:39 -05:00
|
|
|
// cdb-only
|
|
|
|
// min-cdb-version: 10.0.18317.1001
|
|
|
|
// compile-flags:-g
|
|
|
|
|
|
|
|
// === CDB TESTS ==================================================================================
|
|
|
|
|
|
|
|
// cdb-command: g
|
|
|
|
|
|
|
|
// cdb-command: dx x,d
|
[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:x,d : Ok [Type: enum2$<core::result::Result<i32,ref$<str$> > >]
|
2021-03-30 12:43:39 -05:00
|
|
|
// cdb-check: [...] __0 : -3 [Type: int]
|
|
|
|
|
|
|
|
// cdb-command: dx y
|
[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:y : Err [Type: enum2$<core::result::Result<i32,ref$<str$> > >]
|
|
|
|
// cdb-check: [...] __0 : "Some error message" [Type: ref$<str$>]
|
2021-03-30 12:43:39 -05:00
|
|
|
|
2022-07-07 08:01:43 -05:00
|
|
|
fn main() {
|
2021-03-30 12:43:39 -05:00
|
|
|
let x: Result<i32, &str> = Ok(-3);
|
|
|
|
assert_eq!(x.is_ok(), true);
|
|
|
|
|
|
|
|
let y: Result<i32, &str> = Err("Some error message");
|
|
|
|
assert_eq!(y.is_ok(), false);
|
|
|
|
|
|
|
|
zzz(); // #break.
|
|
|
|
}
|
|
|
|
|
2022-07-07 08:01:43 -05:00
|
|
|
fn zzz() {
|
|
|
|
()
|
|
|
|
}
|