about summary refs log tree commit diff
path: root/compiler/rustc_codegen_ssa/src/debuginfo
diff options
context:
space:
mode:
authorNam Nguyen <nanguye@microsoft.com>2020-11-18 13:42:36 -0800
committerNam Nguyen <nanguye@microsoft.com>2020-11-30 14:31:34 -0800
commit36e6aa0aa686049736810d7444c1bfca8e14d38d (patch)
treee43c76e182f9d8edfa466ca7488056c69071fa88 /compiler/rustc_codegen_ssa/src/debuginfo
parent7d747db0d5dd8f08f2efb073e2e77a34553465a7 (diff)
downloadrust-36e6aa0aa686049736810d7444c1bfca8e14d38d.tar.gz
rust-36e6aa0aa686049736810d7444c1bfca8e14d38d.zip
Stop adding '*' at the end of type names for Ref and Slice when computing debug info for MSVC debuggers
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/debuginfo')
-rw-r--r--compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
index 896af8a9191..d1bbf74307c 100644
--- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
+++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
@@ -94,7 +94,14 @@ pub fn push_debuginfo_type_name<'tcx>(
             push_debuginfo_type_name(tcx, inner_type, true, output, visited);
 
             if cpp_like_names {
-                output.push('*');
+                // Slices and `&str` are treated like C++ pointers when computing debug
+                // info for MSVC debugger. However, adding '*' at the end of these types' names
+                // causes the .natvis engine for WinDbg to fail to display their data, so we opt these
+                // types out to aid debugging in MSVC.
+                match *inner_type.kind() {
+                    ty::Slice(_) | ty::Str => {}
+                    _ => output.push('*'),
+                }
             }
         }
         ty::Array(inner_type, len) => {