|
1 | 1 | use crate::ast::{self, Ident};
|
2 | 2 | use crate::source_map::{SourceMap, FilePathMapping};
|
3 | 3 | use crate::parse::{token, ParseSess};
|
4 |
| -use crate::symbol::{Symbol, keywords}; |
| 4 | +use crate::symbol::Symbol; |
5 | 5 |
|
6 | 6 | use errors::{Applicability, FatalError, Diagnostic, DiagnosticBuilder};
|
7 | 7 | use syntax_pos::{BytePos, CharPos, Pos, Span, NO_EXPANSION};
|
@@ -1249,15 +1249,11 @@ impl<'a> StringReader<'a> {
|
1249 | 1249 | // FIXME: perform NFKC normalization here. (Issue #2253)
|
1250 | 1250 | let ident = self.mk_ident(string);
|
1251 | 1251 |
|
1252 |
| - if is_raw_ident && (ident.is_path_segment_keyword() || |
1253 |
| - ident.name == keywords::Underscore.name()) { |
1254 |
| - self.fatal_span_(raw_start, self.pos, |
1255 |
| - &format!("`r#{}` is not currently supported.", ident.name) |
1256 |
| - ).raise(); |
1257 |
| - } |
1258 |
| - |
1259 | 1252 | if is_raw_ident {
|
1260 | 1253 | let span = self.mk_sp(raw_start, self.pos);
|
| 1254 | + if !ident.can_be_raw() { |
| 1255 | + self.err_span(span, &format!("`{}` cannot be a raw identifier", ident)); |
| 1256 | + } |
1261 | 1257 | self.sess.raw_identifier_spans.borrow_mut().push(span);
|
1262 | 1258 | }
|
1263 | 1259 |
|
|
0 commit comments