Skip to content

Commit 36e6aa0

Browse files
committed
Stop adding '*' at the end of type names for Ref and Slice when computing debug info for MSVC debuggers
1 parent 7d747db commit 36e6aa0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs

+8-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@ pub fn push_debuginfo_type_name<'tcx>(
9494
push_debuginfo_type_name(tcx, inner_type, true, output, visited);
9595

9696
if cpp_like_names {
97-
output.push('*');
97+
// Slices and `&str` are treated like C++ pointers when computing debug
98+
// info for MSVC debugger. However, adding '*' at the end of these types' names
99+
// causes the .natvis engine for WinDbg to fail to display their data, so we opt these
100+
// types out to aid debugging in MSVC.
101+
match *inner_type.kind() {
102+
ty::Slice(_) | ty::Str => {}
103+
_ => output.push('*'),
104+
}
98105
}
99106
}
100107
ty::Array(inner_type, len) => {

0 commit comments

Comments
 (0)