Add SyntaxContext::is_root
This commit is contained in:
parent
99b334696f
commit
73c5c97de7
4 changed files with 20 additions and 15 deletions
|
@ -3,7 +3,7 @@ use rustc_middle::hir;
|
|||
use rustc_middle::mir::*;
|
||||
use rustc_middle::ty::TyCtxt;
|
||||
use rustc_session::config::MirSpanview;
|
||||
use rustc_span::{BytePos, Pos, Span, SyntaxContext};
|
||||
use rustc_span::{BytePos, Pos, Span};
|
||||
|
||||
use std::cmp;
|
||||
use std::io::{self, Write};
|
||||
|
@ -327,7 +327,7 @@ fn compute_block_span(data: &BasicBlockData<'_>, body_span: Span) -> Span {
|
|||
let mut span = data.terminator().source_info.span;
|
||||
for statement_span in data.statements.iter().map(|statement| statement.source_info.span) {
|
||||
// Only combine Spans from the root context, and within the function's body_span.
|
||||
if statement_span.ctxt() == SyntaxContext::root() && body_span.contains(statement_span) {
|
||||
if statement_span.ctxt().is_root() && body_span.contains(statement_span) {
|
||||
span = span.to(statement_span);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue