From e621e3216bfb074b03ddeb045dc467d9ec4641f8 Mon Sep 17 00:00:00 2001 From: Huon Wilson Date: Mon, 10 Nov 2014 21:54:42 +1100 Subject: Add error message specific to \. This can crop-up with a misconfigured editor or an unexpected interaction between version control and certain operating systems. Closes #11669. --- src/libsyntax/parse/lexer/mod.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/libsyntax/parse/lexer') diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index 35d56440b50..01a66243a96 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -806,6 +806,13 @@ impl<'a> StringReader<'a> { if ascii_only { "unknown byte escape" } else { "unknown character escape" }, c); + if e == '\r' { + let sp = codemap::mk_sp(escaped_pos, last_pos); + self.span_diagnostic.span_help( + sp, + "this is an isolated carriage return; consider checking \ + your editor and version control settings.") + } false } } -- cgit 1.4.1-3-g733a5