Skip to content

Commit 2a025c1

Browse files
committed
Remove fallback for containing scopes
This wasn't necessary for msvc and caused issues where different types with the same name such as different instantiations of `Option<T>` would have colliding debuginfo. This confused the debugger which would pick one of the type definitions and use for all types with that name even though they had different layout.
1 parent b644f06 commit 2a025c1

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

compiler/rustc_codegen_llvm/src/debuginfo/metadata.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,6 @@ struct EnumMemberDescriptionFactory<'ll, 'tcx> {
14571457
enum_type: Ty<'tcx>,
14581458
layout: TyAndLayout<'tcx>,
14591459
tag_type_metadata: Option<&'ll DIType>,
1460-
containing_scope: &'ll DIScope,
14611460
common_members: Vec<Option<&'ll DIType>>,
14621461
span: Span,
14631462
}
@@ -1488,11 +1487,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
14881487

14891488
// This will always find the metadata in the type map.
14901489
let fallback = use_enum_fallback(cx);
1491-
let self_metadata = if fallback {
1492-
self.containing_scope
1493-
} else {
1494-
type_metadata(cx, self.enum_type, self.span)
1495-
};
1490+
let self_metadata = type_metadata(cx, self.enum_type, self.span);
14961491

14971492
match self.layout.variants {
14981493
Variants::Single { index } => {
@@ -1607,7 +1602,7 @@ impl EnumMemberDescriptionFactory<'ll, 'tcx> {
16071602
variant,
16081603
variant_info_for(dataful_variant),
16091604
Some(NicheTag),
1610-
self.containing_scope,
1605+
self_metadata,
16111606
self.span,
16121607
);
16131608

@@ -2085,7 +2080,6 @@ fn prepare_enum_metadata(
20852080
enum_type,
20862081
layout,
20872082
tag_type_metadata: discriminant_type_metadata,
2088-
containing_scope,
20892083
common_members: vec![],
20902084
span,
20912085
}),
@@ -2238,7 +2232,6 @@ fn prepare_enum_metadata(
22382232
enum_type,
22392233
layout,
22402234
tag_type_metadata: None,
2241-
containing_scope,
22422235
common_members: outer_fields,
22432236
span,
22442237
}),

0 commit comments

Comments
 (0)