diff options
| author | bors <bors@rust-lang.org> | 2022-10-28 16:27:56 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-28 16:27:56 +0000 |
| commit | 77e7b74ad5c0c449fa378faf5edf33dd2e6fed87 (patch) | |
| tree | b87d8338fb7271b80cab290bb918e7d5e4413907 /compiler/rustc_middle/src | |
| parent | 5237c4d83db0a04a0119918b174ee642acd82d9c (diff) | |
| parent | 34d90a46dac95d6f09cd8851b71b43350eecda4d (diff) | |
| download | rust-77e7b74ad5c0c449fa378faf5edf33dd2e6fed87.tar.gz rust-77e7b74ad5c0c449fa378faf5edf33dd2e6fed87.zip | |
Auto merge of #103071 - wesleywiser:fix_inlined_line_numbers, r=davidtwco
Fix line numbers for MIR inlined code `should_collapse_debuginfo` detects if the specified span is part of a macro expansion however it does this by checking if the span is anything other than a normal (non-expanded) kind, then the span sequence is walked backwards to the root span. This doesn't work when the MIR inliner inlines code as it creates spans with expansion information set to `ExprKind::Inlined` and results in the line number being attributed to the inline callsite rather than the normal line number of the inlined code. Fixes #103068
Diffstat (limited to 'compiler/rustc_middle/src')
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 9671d3a32f9..d90db6dbb7d 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -2604,7 +2604,9 @@ impl<'tcx> TyCtxt<'tcx> { && if self.features().collapse_debuginfo { span.in_macro_expansion_with_collapse_debuginfo() } else { - span.from_expansion() + // Inlined spans should not be collapsed as that leads to all of the + // inlined code being attributed to the inline callsite. + span.from_expansion() && !span.is_inlined() } } |
