Uh oh!
There was an error while loading. Please reload this page.
Improve error messages for raw strings (#60762) - #70522
Conversation
This diff improves error messages around raw strings in a few ways: - Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test) - Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings - Detect potentially intended terminators (longest sequence of "#*" is suggested)
0fc2569 to
629e97aCompareUh 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.
Uh 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.
Uh 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.
Uh oh!
There was an error while loading. Please reload this page.
Centril
commented
Mar 29, 2020
I've left some initial comments, but I'm not qualified to sign off on lexer changes myself. |
Uh 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.
petrochenkov
commented
Mar 30, 2020
@bors r+ |
bors
commented
Mar 30, 2020
📌 Commit 20e2190 has been approved by |
…rochenkov Improve error messages for raw strings (rust-lang#60762) This diff improves error messages around raw strings in a few ways: - Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test) - Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings - Detect potentially intended terminators (longest sequence of "#*" is suggested) Fixesrust-lang#60762 cc @estebank who reviewed the original (abandoned) PR for the same ticket. r? @Centril
bors
commented
Mar 30, 2020
⌛ Testing commit 20e2190 with merge a2e8ca2e8ec00ba36705760e1ff649cd620c531d... |
bors
commented
Mar 30, 2020
💔 Test failed - checks-azure |
petrochenkov
commented
Mar 30, 2020
@bors retry |
…rochenkov Improve error messages for raw strings (rust-lang#60762) This diff improves error messages around raw strings in a few ways: - Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test) - Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings - Detect potentially intended terminators (longest sequence of "#*" is suggested) Fixesrust-lang#60762 cc @estebank who reviewed the original (abandoned) PR for the same ticket. r? @Centril
Centril
commented
Mar 31, 2020
Failed in #70601 (comment), @bors r- |
petrochenkov
commented
Mar 31, 2020
@bors r+ |
bors
commented
Mar 31, 2020
📌 Commit 55a5eea has been approved by |
…rochenkov Improve error messages for raw strings (rust-lang#60762) This diff improves error messages around raw strings in a few ways: - Catch extra trailing `#` in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test) - Refactor & unify error handling in the lexer between ByteStrings and RawByteStrings - Detect potentially intended terminators (longest sequence of "#*" is suggested) Fixesrust-lang#60762 cc @estebank who reviewed the original (abandoned) PR for the same ticket. r? @Centril
Rollup of 6 pull requests Successful merges: - rust-lang#70511 (Add `-Z dump-mir-dataflow` flag for dumping dataflow results visualization) - rust-lang#70522 (Improve error messages for raw strings (rust-lang#60762)) - rust-lang#70547 (Add `can_unwind` field to `FnAbi`) - rust-lang#70591 (Ensure LLVM is in the link path for "fulldeps" tests) - rust-lang#70627 (Use place directly its copy) - rust-lang#70652 (Add git repo address to unstable book) Failed merges: - rust-lang#70634 (Remove some reexports in `rustc_middle`) r? @ghost
CAD97
commented
Apr 4, 2020
cc @matklad is |
matklad
commented
Apr 4, 2020
This seem to fit pretty well into the rustc_lexer interface, which returns tokens as a bunch of sub-offsets. Ideally, we should dissolve lexer cooking altogether and instead lower the tokens much later, after macro expansion. |
This diff improves error messages around raw strings in a few ways:
#in the parser. This can't be handled in the lexer because we could be in a macro that actually expects another # (see test)Fixes#60762
cc @estebank who reviewed the original (abandoned) PR for the same ticket.
r? @Centril