about summary refs log tree commit diff
path: root/src/libsyntax/parse/lexer/unicode_chars.rs
diff options
context:
space:
mode:
authorZack M. Davis <code@zackmdavis.net>2018-04-15 14:30:23 -0700
committerEsteban Küber <esteban@kuber.com.ar>2018-05-25 20:48:31 -0700
commit6437295b173a17361fdca1a45d2f9e7547cbc99f (patch)
tree127b25cabc961c5d5ca67b7e207a69d52609ee03 /src/libsyntax/parse/lexer/unicode_chars.rs
parent7426f5ccf7b362785a5abeb365674d3da3d4df2e (diff)
downloadrust-6437295b173a17361fdca1a45d2f9e7547cbc99f.tar.gz
rust-6437295b173a17361fdca1a45d2f9e7547cbc99f.zip
in which we check for confusable Unicodepoints in float literal exponent
The `FatalError.raise()` might seem unmotivated (in most places in
the compiler, `err.emit()` suffices), but it's actually used to
maintain behavior (viz., stop lexing, don't emit potentially spurious
errors looking for the next token after the bad Unicodepoint in the
exponent): the previous revision's `self.err_span_` ultimately calls
`Handler::emit`, which aborts if the `Handler`'s continue_after_error
flag is set, which seems to typically be true during lexing (see
`phase_1_parse_input` and and how `CompileController::basic` has
`continue_parse_after_error: false` in librustc_driver).

Also, let's avoid apostrophes in error messages (the present author
would argue that users expect a reassuringly detached, formal,
above-it-all tone from a Serious tool like a compiler), and use an
RLS-friendly structured suggestion.

Resolves #49746.
Diffstat (limited to 'src/libsyntax/parse/lexer/unicode_chars.rs')
-rw-r--r--src/libsyntax/parse/lexer/unicode_chars.rs4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libsyntax/parse/lexer/unicode_chars.rs b/src/libsyntax/parse/lexer/unicode_chars.rs
index 35afe8dd56d..3c0bb82212f 100644
--- a/src/libsyntax/parse/lexer/unicode_chars.rs
+++ b/src/libsyntax/parse/lexer/unicode_chars.rs
@@ -344,9 +344,9 @@ pub fn check_for_substitution<'a>(reader: &StringReader<'a>,
         match ASCII_ARRAY.iter().find(|&&(c, _)| c == ascii_char) {
             Some(&(ascii_char, ascii_name)) => {
                 let msg =
-                    format!("unicode character '{}' ({}) looks like '{}' ({}), but it's not",
+                    format!("Unicode character '{}' ({}) looks like '{}' ({}), but it is not",
                             ch, u_name, ascii_char, ascii_name);
-                err.span_help(span, &msg);
+                err.span_suggestion(span, &msg, ascii_char.to_string());
             },
             None => {
                 let msg = format!("substitution character not found for '{}'", ch);