Skip to content

Commit 80f6558

Browse files
committed
WIP fix inlining spans
1 parent 7a23496 commit 80f6558

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

compiler/rustc_mir_transform/src/annotate_moves.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,19 @@ impl AnnotateMoves {
233233
original_source_info.span,
234234
);
235235

236+
// Get the span of the intrinsic function definition - this represents
237+
// "where we are inside the inlined function"
238+
let intrinsic_span = tcx.def_span(intrinsic_def_id);
239+
236240
// Create new inlined scope that makes the operation appear to come from the intrinsic
237241
let inlined_scope_data = SourceScopeData {
238-
span: original_source_info.span,
242+
// Use the intrinsic's definition span to show where we are "inside" the inlined function
243+
span: intrinsic_span,
239244
parent_scope: Some(original_source_info.scope),
240245

241-
// Pretend this op is inlined from the intrinsic
246+
// The inlined field shows: (what was inlined, where it was called from)
247+
// - intrinsic_instance: the compiler_move/copy function that was "inlined"
248+
// - original_source_info.span: the call site (where the actual move/copy is)
242249
inlined: Some((intrinsic_instance, original_source_info.span)),
243250

244251
// Proper inlined scope chaining to maintain debug info hierarchy

0 commit comments

Comments
 (0)