diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-08-11 01:44:55 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2019-08-15 20:38:12 +0300 |
| commit | 67d6ce42063732d7c7b12d94f872dcafb5efb607 (patch) | |
| tree | 4e9a94b42b8eeb2bd71603ea5fdabef42bc8b134 /src/libsyntax/parse/lexer/unicode_chars.rs | |
| parent | dfcbe75900f2cb813754ef104526ebce568fd75b (diff) | |
| download | rust-67d6ce42063732d7c7b12d94f872dcafb5efb607.tar.gz rust-67d6ce42063732d7c7b12d94f872dcafb5efb607.zip | |
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
Diffstat (limited to 'src/libsyntax/parse/lexer/unicode_chars.rs')
| -rw-r--r-- | src/libsyntax/parse/lexer/unicode_chars.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libsyntax/parse/lexer/unicode_chars.rs b/src/libsyntax/parse/lexer/unicode_chars.rs index eaa736c6a35..525b4215aff 100644 --- a/src/libsyntax/parse/lexer/unicode_chars.rs +++ b/src/libsyntax/parse/lexer/unicode_chars.rs @@ -3,7 +3,7 @@ use super::StringReader; use errors::{Applicability, DiagnosticBuilder}; -use syntax_pos::{BytePos, Pos, Span, NO_EXPANSION, symbol::kw}; +use syntax_pos::{BytePos, Pos, Span, symbol::kw}; use crate::parse::token; #[rustfmt::skip] // for line breaks @@ -343,7 +343,7 @@ crate fn check_for_substitution<'a>( None => return None, }; - let span = Span::new(pos, pos + Pos::from_usize(ch.len_utf8()), NO_EXPANSION); + let span = Span::with_root_ctxt(pos, pos + Pos::from_usize(ch.len_utf8())); let (ascii_name, token) = match ASCII_ARRAY.iter().find(|&&(c, _, _)| c == ascii_char) { Some((_ascii_char, ascii_name, token)) => (ascii_name, token), @@ -362,10 +362,9 @@ crate fn check_for_substitution<'a>( ascii_char, ascii_name ); err.span_suggestion( - Span::new( + Span::with_root_ctxt( pos, pos + Pos::from_usize('“'.len_utf8() + s.len() + '”'.len_utf8()), - NO_EXPANSION, ), &msg, format!("\"{}\"", s), |
