diff --git a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
index 0db6659f8e25..7a44e887c893 100644
--- a/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
+++ b/compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs
@@ -1574,7 +1574,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
MemberDescription {
name: if fallback {
- String::new()
+ format!("Variant{}", i.as_u32())
} else {
variant_info.variant_name()
},
@@ -1886,8 +1886,9 @@ fn describe_enum_variant(
// We have the layout of an enum variant, we need the layout of the outer enum
let enum_layout = cx.layout_of(layout.ty);
let offset = enum_layout.fields.offset(tag_field.as_usize());
+ let tag_name = if cx.tcx.sess.target.is_like_msvc { "variant$" } else { "RUST$ENUM$DISR" };
let args =
- ("RUST$ENUM$DISR".to_owned(), enum_layout.field(cx, tag_field.as_usize()).ty);
+ (tag_name.to_owned(), enum_layout.field(cx, tag_field.as_usize()).ty);
(Some(offset), Some(args))
}
_ => (None, None),
@@ -2062,7 +2063,7 @@ fn prepare_enum_metadata(
unsafe {
llvm::LLVMRustDIBuilderCreateUnionType(
DIB(cx),
- containing_scope,
+ None,
enum_name.as_ptr().cast(),
enum_name.len(),
file_metadata,
@@ -2437,7 +2438,7 @@ fn create_union_stub(
llvm::LLVMRustDIBuilderCreateUnionType(
DIB(cx),
- containing_scope,
+ Some(containing_scope),
union_type_name.as_ptr().cast(),
union_type_name.len(),
unknown_file_metadata(cx),
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
index 8b1dcea3fa26..54ef1a284689 100644
--- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs
@@ -2038,7 +2038,7 @@ extern "C" {
pub fn LLVMRustDIBuilderCreateUnionType(
Builder: &DIBuilder<'a>,
- Scope: &'a DIScope,
+ Scope: Option<&'a DIScope>,
Name: *const c_char,
NameLen: size_t,
File: &'a DIFile,
diff --git a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
index d1bbf74307c6..626c71abf63d 100644
--- a/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
+++ b/compiler/rustc_codegen_ssa/src/debuginfo/type_names.rs
@@ -45,8 +45,16 @@ pub fn push_debuginfo_type_name<'tcx>(
ty::Float(float_ty) => output.push_str(float_ty.name_str()),
ty::Foreign(def_id) => push_item_name(tcx, def_id, qualified, output),
ty::Adt(def, substs) => {
+ if def.is_enum() && cpp_like_names {
+ output.push_str("_enum<");
+ }
+
push_item_name(tcx, def.did, qualified, output);
push_type_params(tcx, substs, output, visited);
+
+ if def.is_enum() && cpp_like_names {
+ output.push('>');
+ }
}
ty::Tuple(component_types) => {
if cpp_like_names {
diff --git a/src/etc/natvis/intrinsic.natvis b/src/etc/natvis/intrinsic.natvis
index 030892a432b3..45e36f929b4d 100644
--- a/src/etc/natvis/intrinsic.natvis
+++ b/src/etc/natvis/intrinsic.natvis
@@ -149,4 +149,42 @@
...
+
+
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+ {tag(),en}
+
+
+ Variant0
+ Variant1
+ Variant2
+ Variant3
+ Variant4
+ Variant5
+ Variant6
+ Variant7
+ Variant8
+ Variant9
+ Variant10
+ Variant11
+ Variant12
+ Variant13
+ Variant14
+ Variant15
+
+
diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis
index 9c3c26f59783..17667770520c 100644
--- a/src/etc/natvis/libcore.natvis
+++ b/src/etc/natvis/libcore.natvis
@@ -14,14 +14,6 @@
-
- None
- Some({__0})
-
- - __0
-
-
-
None
Some({($T1 *)this})
@@ -30,15 +22,6 @@
-
- Ok({__0})
- Err({(*($T2*) &__0)})
-
- - __0
- - (*($T2*) &__0)
-
-
-
{(void*) pointer}