about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorYuki Okushi <huyuumi.dev@gmail.com>2019-01-20 04:37:29 +0900
committerYuki Okushi <huyuumi.dev@gmail.com>2019-01-20 04:37:29 +0900
commitc502a79fa1a15de88623bc01d9a1c38db3ea2c1b (patch)
tree8ce2af9b2639079bbd492a677bc87c2b00b5223d /src/libsyntax/parse
parentb721c1a885537de960733a54f86ba7a6f24a4857 (diff)
downloadrust-c502a79fa1a15de88623bc01d9a1c38db3ea2c1b.tar.gz
rust-c502a79fa1a15de88623bc01d9a1c38db3ea2c1b.zip
[WIP] Improve error behavior
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 2bf7ff4bd7a..fcaa35d1fca 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -1408,9 +1408,10 @@ impl<'a> StringReader<'a> {
                     // lifetimes shouldn't end with a single quote
                     // if we find one, then this is an invalid character literal
                     if self.ch_is('\'') {
-                        self.fatal_span_verbose(start_with_quote, self.next_pos,
-                                String::from("character literal may only contain one codepoint"))
-                            .raise();
+                        self.err_span_(start_with_quote, self.next_pos,
+                                "character literal may only contain one codepoint");
+                        self.bump();
+                        return Ok(token::Literal(token::Err(Symbol::intern("??")), None))
 
                     }
 
@@ -1445,7 +1446,7 @@ impl<'a> StringReader<'a> {
                                     format!("\"{}\"", &self.src[start..end]),
                                     Applicability::MachineApplicable
                                 ).emit();
-                            return Ok(token::Literal(token::Char(Symbol::intern("??")), None))
+                            return Ok(token::Literal(token::Err(Symbol::intern("??")), None))
                         }
                         if self.ch_is('\n') || self.is_eof() || self.ch_is('/') {
                             // Only attempt to infer single line string literals. If we encounter
@@ -1455,8 +1456,9 @@ impl<'a> StringReader<'a> {
                         }
                     }
 
-                    self.fatal_span_verbose(start_with_quote, pos,
-                        String::from("character literal may only contain one codepoint")).raise();
+                    self.err_span_(start_with_quote, pos,
+                        "character literal may only contain one codepoint");
+                    self.bump();
                 }
 
                 let id = if valid {