Function rustc_mir::transform::coverage::spans::function_source_span[−][src]

fn function_source_span(span: Span, body_span: Span) -> (Span, Span)
Expand description

Returns two spans from the given span (the span associated with a Statement or Terminator):

  1. An extrapolated span (pre-expansion1) corresponding to a range within the function’s body source. This span is guaranteed to be contained within, or equal to, the body_span. If the extrapolated span is not contained within the body_span, the body_span is returned.
  2. The actual span value from the Statement, before expansion.

Only the first span is used when computing coverage code regions. The second span is useful if additional expansion data is needed (such as to look up the macro name for a composed span within that macro).)

1Expansions result from Rust syntax including macros, syntactic sugar, etc.).


  1.  ↩