about summary refs log tree commit diff
path: root/compiler/rustc_pattern_analysis/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-12-28 00:04:05 +0000
committerbors <bors@rust-lang.org>2023-12-28 00:04:05 +0000
commit8e346422620b4884e42f6e52482be74c265b9157 (patch)
treee2dd9c7b8544918bdf16c54410aad7f64317611a /compiler/rustc_pattern_analysis/src
parent89e2160c4ca5808657ed55392620ed1dbbce78d1 (diff)
parentbe6b059169aa8e7cde3a80fdadd772a4b77f55ff (diff)
downloadrust-8e346422620b4884e42f6e52482be74c265b9157.tar.gz
rust-8e346422620b4884e42f6e52482be74c265b9157.zip
Auto merge of #119336 - Zalathar:find-ancestor, r=petrochenkov
coverage: Unexpand spans with `find_ancestor_inside_same_ctxt`

Back in https://github.com/rust-lang/rust/pull/118525#discussion_r1412877621 it was observed that our `unexpand_into_body_span` now looks very similar to `Span::find_ancestor_inside`.

At the time I tried switching over, but doing so resulted in incorrect coverage mappings (or assertion failures), so I left a `FIXME` comment instead.

After some investigation, I identified the two problems with my original approach:
- I should have been using `find_ancestor_inside_same_ctxt` instead, since we want a span that's inside the body and has the same context as the body.
- For async functions, we were actually using the post-expansion body span, which is why we needed to forcibly set the unexpanded span's context to match the body span. For body spans produced by macro-expansion, we already have special-case code to detect this and use the pre-expansion call site as the body span. By making this code also detect async desugaring, I was able to end up with a body span that works properly with `find_ancestor_inside_same_ctxt`, avoiding the need to forcibly change the span context.
Diffstat (limited to 'compiler/rustc_pattern_analysis/src')
0 files changed, 0 insertions, 0 deletions