From 5d59b4412e71298e6e44b55afbfaa9dd86aee590 Mon Sep 17 00:00:00 2001 From: Anton Golov Date: Fri, 30 Jul 2021 16:09:33 +0200 Subject: Add warning when whitespace is not skipped after an escaped newline. --- compiler/rustc_parse/src/lexer/unescape_error_reporting.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'compiler/rustc_parse') 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(); + } } } -- cgit 1.4.1-3-g733a5