about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src/coverage/unexpand.rs
blob: 922edd3cc4feec2c5190c1101d618dc149670d7b (plain)
1
2
3
4
5
6
7
8
9
use rustc_span::Span;

/// Walks through the expansion ancestors of `original_span` to find a span that
/// is contained in `body_span` and has the same [syntax context] as `body_span`.
pub(crate) fn unexpand_into_body_span(original_span: Span, body_span: Span) -> Option<Span> {
    // Because we don't need to return any extra ancestor information,
    // we can just delegate directly to `find_ancestor_inside_same_ctxt`.
    original_span.find_ancestor_inside_same_ctxt(body_span)
}