Uh oh!
There was an error while loading. Please reload this page.
Add warning when whitespace is not skipped after an escaped newline - #87596
Conversation
rust-highfive
commented
Jul 29, 2021
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @estebank (or someone else) soon. Please see the contribution instructions for more information. |
One thing I was wondering about: prior to this PR, the lexer only has support for emitting errors. I've added warnings by changing the callback, but I'm not sure it's the best approach. Is it too messy? One other option would be to pass an emit_char and an emit_err callback, since those require mostly orthogonal code, but that would require a bit more reworking of the |
This comment has been minimized.
This comment has been minimized.
jesyspa
commented
Jul 29, 2021
Sorry, I missed the clippy code when testing locally. I'll update the PR and re-run the checks. |
53a297d to
d7f524fCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
In principle I'm ok with the approach of nested Results, but in this case it feels like a better way would be to make UnskippedWhitespaceAfterEscapedNewline a variant of EscapeError. I know it muddles the waters a little bit by mixing warnings and errors, but I feel it is worth it due to the flattening of the code in this PR.
There was a problem hiding this comment.
Makes sense, I've changed it to be a single type. Should I also change the name to EscapeDiagnostic, or is that too vague?
There was a problem hiding this comment.
I feel like EscapeError is slightly misleading, but it'll make more sense than EscapeDiagnostic.
fcd287c to
bc8bbebCompare
This comment has been minimized.
This comment has been minimized.
bc8bbeb to
5d59b44Compareestebank
commented
Jul 30, 2021
@bors r+ |
bors
commented
Jul 30, 2021
📌 Commit 5d59b44 has been approved by |
…ce, r=estebank Add warning when whitespace is not skipped after an escaped newline Fixes issue rust-lang#87318, also simplifies issue rust-lang#87319. * Add support to the lexer to emit warnings as well as errors. * Emit a warning when a string literal contains an escaped newline, but when (some of) the whitespace on the next line is not skipped due to it being non-ASCII.
Rollup of 9 pull requests Successful merges: - rust-lang#86072 (Cross compiling rustc_llvm on Darwin requires zlib.) - rust-lang#87385 (Make `SEMICOLON_IN_EXPRESSIONS_FROM_MACROS` warn by default) - rust-lang#87547 (Add missing examples for NonNull) - rust-lang#87557 (Fix issue with autofix for ambiguous associated function from Rust 2021 prelude when struct is generic) - rust-lang#87559 (Tweak borrowing suggestion in `for` loop) - rust-lang#87596 (Add warning when whitespace is not skipped after an escaped newline) - rust-lang#87606 (Add some TAIT-related regression tests) - rust-lang#87609 (Add docs about performance and `Iterator::map` to `[T; N]::map`) - rust-lang#87616 (Fix missing word in rustdoc book) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
Fixes issue #87318, also simplifies issue #87319.