Skip to content

Commit 7ff01a4

Browse files
committed
Use mir::SourceInfo again in FunctionCx.source_info_set
Fixes #800
1 parent 399cada commit 7ff01a4

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

src/common.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,7 @@ pub struct FunctionCx<'clif, 'tcx, B: Backend + 'static> {
270270
pub constants_cx: &'clif mut crate::constant::ConstantCx,
271271
pub caches: &'clif mut Caches<'tcx>,
272272

273-
// FIXME switch back to `SourceInfo`, once it derives `Eq` and `Hash` again.
274-
pub source_info_set: indexmap::IndexSet<(Span, mir::SourceScope)>,
273+
pub source_info_set: indexmap::IndexSet<SourceInfo>,
275274
}
276275

277276
impl<'tcx, B: Backend> LayoutOf for FunctionCx<'_, 'tcx, B> {
@@ -350,7 +349,7 @@ impl<'tcx, B: Backend + 'static> FunctionCx<'_, 'tcx, B> {
350349
}
351350

352351
pub fn set_debug_loc(&mut self, source_info: mir::SourceInfo) {
353-
let (index, _) = self.source_info_set.insert_full((source_info.span, source_info.scope));
352+
let (index, _) = self.source_info_set.insert_full(source_info);
354353
self.bcx.set_srcloc(SourceLoc::new(index as u32));
355354
}
356355

src/debuginfo/line_info.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
105105
&mut self,
106106
context: &Context,
107107
isa: &dyn cranelift_codegen::isa::TargetIsa,
108-
source_info_set: &indexmap::IndexSet<(Span, mir::SourceScope)>,
108+
source_info_set: &indexmap::IndexSet<SourceInfo>,
109109
) -> CodeOffset {
110110
let tcx = self.debug_context.tcx;
111111

@@ -147,7 +147,7 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
147147
line_program.row().address_offset = offset as u64;
148148
if !srcloc.is_default() {
149149
let source_info = *source_info_set.get_index(srcloc.bits() as usize).unwrap();
150-
create_row_for_span(line_program, source_info.0);
150+
create_row_for_span(line_program, source_info.span);
151151
} else {
152152
create_row_for_span(line_program, self.mir.span);
153153
}

src/debuginfo/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ impl<'a, 'tcx> FunctionDebugContext<'a, 'tcx> {
254254
&mut self,
255255
context: &Context,
256256
isa: &dyn cranelift_codegen::isa::TargetIsa,
257-
source_info_set: &indexmap::IndexSet<(Span, mir::SourceScope)>,
257+
source_info_set: &indexmap::IndexSet<SourceInfo>,
258258
local_map: HashMap<mir::Local, CPlace<'tcx>>,
259259
) {
260260
let end = self.create_debug_lines(context, isa, source_info_set);

0 commit comments

Comments
 (0)