1
Fork 0

syntax_pos: NO_EXPANSION/SyntaxContext::empty() -> SyntaxContext::root()

For consistency with `ExpnId::root`.

Also introduce a helper `Span::with_root_ctxt` for creating spans with `SyntaxContext::root()` context
This commit is contained in:
Vadim Petrochenkov 2019-08-11 01:44:55 +03:00
parent dfcbe75900
commit 67d6ce4206
20 changed files with 53 additions and 53 deletions

View file

@ -43,8 +43,7 @@ use syntax_pos::{BytePos,
SourceFile,
FileName,
MultiSpan,
Span,
NO_EXPANSION};
Span};
/// Indicates the confidence in the correctness of a suggestion.
///
@ -189,7 +188,7 @@ impl CodeSuggestion {
// Find the bounding span.
let lo = substitution.parts.iter().map(|part| part.span.lo()).min().unwrap();
let hi = substitution.parts.iter().map(|part| part.span.hi()).min().unwrap();
let bounding_span = Span::new(lo, hi, NO_EXPANSION);
let bounding_span = Span::with_root_ctxt(lo, hi);
let lines = cm.span_to_lines(bounding_span).unwrap();
assert!(!lines.lines.is_empty());