diff options
| author | Michael Woerister <michaelwoerister@posteo> | 2022-10-25 12:28:03 +0200 |
|---|---|---|
| committer | Michael Woerister <michaelwoerister@posteo> | 2022-10-31 15:43:44 +0100 |
| commit | 0cd2dd7263a20ba62591039cd3591c8eaef13878 (patch) | |
| tree | 7a9b322b39dc101763de59789b716dd70cd9c88b /src/etc | |
| parent | 1481fd964bac3c750c7e1b21206fdaa60346c456 (diff) | |
| download | rust-0cd2dd7263a20ba62591039cd3591c8eaef13878.tar.gz rust-0cd2dd7263a20ba62591039cd3591c8eaef13878.zip | |
[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.
Diffstat (limited to 'src/etc')
| -rw-r--r-- | src/etc/natvis/intrinsic.natvis | 12 | ||||
| -rw-r--r-- | src/etc/natvis/liballoc.natvis | 8 |
2 files changed, 14 insertions, 6 deletions
diff --git a/src/etc/natvis/intrinsic.natvis b/src/etc/natvis/intrinsic.natvis index 277e57aaf6f..8c16a562e34 100644 --- a/src/etc/natvis/intrinsic.natvis +++ b/src/etc/natvis/intrinsic.natvis @@ -1,6 +1,10 @@ <?xml version="1.0" encoding="utf-8"?> <AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010"> - <Type Name="str"> + <Type Name="ref$<str$>"> + <AlternativeType Name="ref_mut$<str$>" /> + <AlternativeType Name="ptr_const$<str$>" /> + <AlternativeType Name="ptr_mut$<str$>" /> + <DisplayString>{(char*)data_ptr,[length]s8}</DisplayString> <StringView>(char*)data_ptr,[length]s8</StringView> <Expand> @@ -15,7 +19,11 @@ </Synthetic> </Expand> </Type> - <Type Name="slice$<*>"> + <Type Name="ref$<slice2$<*> >"> + <AlternativeType Name="ref_mut$<slice2$<*> >" /> + <AlternativeType Name="ptr_const$<slice2$<*> >" /> + <AlternativeType Name="ptr_mut$<slice2$<*> >" /> + <DisplayString>{{ len={length} }}</DisplayString> <Expand> <Item Name="[len]" ExcludeView="simple">length</Item> diff --git a/src/etc/natvis/liballoc.natvis b/src/etc/natvis/liballoc.natvis index bf6c02b9146..41f4a3767f5 100644 --- a/src/etc/natvis/liballoc.natvis +++ b/src/etc/natvis/liballoc.natvis @@ -85,7 +85,7 @@ </Type> <!-- alloc::rc::Rc<[T]> --> - <Type Name="alloc::rc::Rc<slice$<*> >"> + <Type Name="alloc::rc::Rc<slice2$<*> >"> <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString> <Expand> <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item> @@ -115,7 +115,7 @@ </Type> <!-- alloc::rc::Weak<[T]> --> - <Type Name="alloc::rc::Weak<slice$<*> >"> + <Type Name="alloc::rc::Weak<slice2$<*> >"> <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString> <Expand> <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item> @@ -144,7 +144,7 @@ </Type> <!-- alloc::sync::Arc<[T]> --> - <Type Name="alloc::sync::Arc<slice$<*> >"> + <Type Name="alloc::sync::Arc<slice2$<*> >"> <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString> <Expand> <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item> @@ -173,7 +173,7 @@ </Type> <!-- alloc::sync::Weak<[T]> --> - <Type Name="alloc::sync::Weak<slice$<*> >"> + <Type Name="alloc::sync::Weak<slice2$<*> >"> <DisplayString>{{ len={ptr.pointer.length} }}</DisplayString> <Expand> <Item Name="[Length]" ExcludeView="simple">ptr.pointer.length</Item> |
