about summary refs log tree commit diff
path: root/compiler/rustc_parse
diff options
context:
space:
mode:
authorAnton Golov <jesyspa@gmail.com>2021-07-30 16:09:33 +0200
committerAnton Golov <jesyspa@gmail.com>2021-07-30 16:26:39 +0200
commit5d59b4412e71298e6e44b55afbfaa9dd86aee590 (patch)
tree61861a3d3fa2d1f48f61b69793bf817e8e200364 /compiler/rustc_parse
parent1195bea5a7b73e079fa14b37ac7e375fc77d368a (diff)
downloadrust-5d59b4412e71298e6e44b55afbfaa9dd86aee590.tar.gz
rust-5d59b4412e71298e6e44b55afbfaa9dd86aee590.zip
Add warning when whitespace is not skipped after an escaped newline.
Diffstat (limited to 'compiler/rustc_parse')
-rw-r--r--compiler/rustc_parse/src/lexer/unescape_error_reporting.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs
index a580f0c55d0..1c5be61130b 100644
--- a/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs
+++ b/compiler/rustc_parse/src/lexer/unescape_error_reporting.rs
@@ -253,6 +253,12 @@ pub(crate) fn emit_unescape_error(
             let msg = "invalid trailing slash in literal";
             handler.struct_span_err(span, msg).span_label(span, msg).emit();
         }
+        EscapeError::UnskippedWhitespaceWarning => {
+            let (c, char_span) = last_char();
+            let msg =
+                format!("non-ASCII whitespace symbol '{}' is not skipped", c.escape_unicode());
+            handler.struct_span_warn(span, &msg).span_label(char_span, &msg).emit();
+        }
     }
 }