69 lines
3.1 KiB
Diff
69 lines
3.1 KiB
Diff
From b4b8777b049f7394fff8eefaaa3b4cb3a8f16ff4 Mon Sep 17 00:00:00 2001
|
|
From: Kyle Huey <khuey@kylehuey.com>
|
|
Date: Tue, 22 Oct 2024 10:58:56 -0700
|
|
Subject: [PATCH] Drop debug info that would conflict and trigger #131944
|
|
|
|
---
|
|
.../rustc_codegen_ssa/src/mir/debuginfo.rs | 25 +++++++++++++------
|
|
1 file changed, 18 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
|
|
index 75692540c034..35cb0e25b6cc 100644
|
|
--- a/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
|
|
+++ b/compiler/rustc_codegen_ssa/src/mir/debuginfo.rs
|
|
@@ -448,7 +448,8 @@ pub fn compute_per_local_var_debug_info(
|
|
}
|
|
|
|
let mut per_local = IndexVec::from_elem(vec![], &self.mir.local_decls);
|
|
- let mut params_seen: FxHashMap<_, Bx::DIVariable> = Default::default();
|
|
+ let mut params_seen: FxHashMap<_, (Bx::DIVariable, Span, mir::SourceScope)> =
|
|
+ Default::default();
|
|
for var in &self.mir.var_debug_info {
|
|
let dbg_scope_and_span = if full_debug_info {
|
|
self.adjusted_span_and_dbg_scope(var.source_info)
|
|
@@ -467,7 +468,7 @@ pub fn compute_per_local_var_debug_info(
|
|
}
|
|
};
|
|
|
|
- let dbg_var = dbg_scope_and_span.map(|(dbg_scope, _, span)| {
|
|
+ let dbg_var = dbg_scope_and_span.and_then(|(dbg_scope, _, span)| {
|
|
let var_kind = if let Some(arg_index) = var.argument_index
|
|
&& var.composite.is_none()
|
|
&& let mir::VarDebugInfoContents::Place(place) = var.value
|
|
@@ -493,18 +494,28 @@ pub fn compute_per_local_var_debug_info(
|
|
VariableKind::LocalVariable
|
|
};
|
|
|
|
- if let VariableKind::ArgumentVariable(arg_index) = var_kind {
|
|
+ Some(if let VariableKind::ArgumentVariable(arg_index) = var_kind {
|
|
match params_seen.entry((dbg_scope, arg_index)) {
|
|
- Entry::Occupied(o) => o.get().clone(),
|
|
+ Entry::Occupied(o) => {
|
|
+ let (seen_var, seen_span, seen_source_scope) = o.get();
|
|
+ if *seen_span == span && *seen_source_scope != var.source_info.scope {
|
|
+ return None;
|
|
+ } else {
|
|
+ seen_var.clone()
|
|
+ }
|
|
+ }
|
|
Entry::Vacant(v) => v
|
|
- .insert(
|
|
+ .insert((
|
|
self.cx.create_dbg_var(var.name, var_ty, dbg_scope, var_kind, span),
|
|
- )
|
|
+ span,
|
|
+ var.source_info.scope,
|
|
+ ))
|
|
+ .0
|
|
.clone(),
|
|
}
|
|
} else {
|
|
self.cx.create_dbg_var(var.name, var_ty, dbg_scope, var_kind, span)
|
|
- }
|
|
+ })
|
|
});
|
|
|
|
let fragment = if let Some(ref fragment) = var.composite {
|
|
--
|
|
2.47.0
|
|
|