Skip to content

Commit

Permalink
auto merge of #14400 : kballard/rust/lexer_crlf_handling, r=cmr
Browse files Browse the repository at this point in the history
The lexer already ignores CRLF in between tokens, but it doesn't
properly handle carriage returns inside strings and doc comments. Teach
it to treat CRLF as LF inside these tokens, and to disallow carriage
returns that are not followed by linefeeds. This includes handling an
escaped CRLF inside a regular string token the same way it handles an
escaped LF.

This is technically a breaking change, as bare carriage returns are no
longer allowed, and CRLF sequences are now treated as LF inside strings
and doc comments, but it's very unlikely to actually affect any
real-world code.

This change is necessary to have Rust code compile on Windows the same
way it does on Unix. The mozilla/rust repository explicitly sets eol=lf
for Rust source files, but other Rust repositories don't. Notably,
rust-http cannot be compiled on Windows without converting the CRLF line
endings back to LF.

[breaking-change]
  • Loading branch information
bors committed Jun 19, 2014
2 parents f05cd6e + 8a8e497 commit f8c9aec
Show file tree
Hide file tree
Showing 5 changed files with 270 additions and 68 deletions.
Loading

0 comments on commit f8c9aec

Please sign in to comment.