about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2018-05-25 21:57:02 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-05-26 12:03:50 -0700
commit7dec8a4e99ee10696a3b1e61bfa5918683c49437 (patch)
tree7a10cf1ba3390ab80a500f1522acfa94744b60ef /src/libsyntax/parse
parent6437295b173a17361fdca1a45d2f9e7547cbc99f (diff)
downloadrust-7dec8a4e99ee10696a3b1e61bfa5918683c49437.tar.gz
rust-7dec8a4e99ee10696a3b1e61bfa5918683c49437.zip
Fix test
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs6
-rw-r--r--src/libsyntax/parse/lexer/unicode_chars.rs6
2 files changed, 8 insertions, 4 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 50a398d8c63..c39eb1594b2 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -1081,10 +1081,12 @@ impl<'a> StringReader<'a> {
                 );
                 if let Some(ch) = self.ch {
                     // check for e.g. Unicode minus '−' (Issue #49746)
-                    unicode_chars::check_for_substitution(self, ch, &mut err);
+                    if unicode_chars::check_for_substitution(self, ch, &mut err) {
+                        self.bump();
+                        self.scan_digits(10, 10);
+                    }
                 }
                 err.emit();
-                FatalError.raise();
             }
         }
     }
diff --git a/src/libsyntax/parse/lexer/unicode_chars.rs b/src/libsyntax/parse/lexer/unicode_chars.rs
index 3c0bb82212f..c5c2e025233 100644
--- a/src/libsyntax/parse/lexer/unicode_chars.rs
+++ b/src/libsyntax/parse/lexer/unicode_chars.rs
@@ -335,7 +335,7 @@ const ASCII_ARRAY: &'static [(char, &'static str)] = &[
 
 pub fn check_for_substitution<'a>(reader: &StringReader<'a>,
                                   ch: char,
-                                  err: &mut DiagnosticBuilder<'a>) {
+                                  err: &mut DiagnosticBuilder<'a>) -> bool {
     UNICODE_ARRAY
     .iter()
     .find(|&&(c, _, _)| c == ch)
@@ -347,11 +347,13 @@ pub fn check_for_substitution<'a>(reader: &StringReader<'a>,
                     format!("Unicode character '{}' ({}) looks like '{}' ({}), but it is not",
                             ch, u_name, ascii_char, ascii_name);
                 err.span_suggestion(span, &msg, ascii_char.to_string());
+                true
             },
             None => {
                 let msg = format!("substitution character not found for '{}'", ch);
                 reader.sess.span_diagnostic.span_bug_no_panic(span, &msg);
+                false
             }
         }
-    });
+    }).unwrap_or(false)
 }