-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lookahead for closing curly quote when encountering opening curly quote #58436
Comments
I could maybe do this with some mentoring, if not too difficult or trivial... |
@pmccarter this method is the one that supplies the error: rust/src/libsyntax/parse/lexer/unicode_chars.rs Lines 326 to 353 in e544947
It gets called from the lexer: rust/src/libsyntax/parse/lexer/mod.rs Line 1645 in e544947
It should be possible to special case the The Forge has info on setting up the repo and building your own |
Special suggestion for illegal unicode curly quote pairs Fixes rust-lang#58436 Did not end up expanding the error message span to include the full string literal since I figured the start of the token was the issue, while the help suggestion span would include up to the closing quotation mark. The look ahead logic does not affect the reader position, not sure if that is an issue (if eg it should still continue to parse after the closing quote without erroring out).
Special suggestion for illegal unicode curly quote pairs Fixes rust-lang#58436 Did not end up expanding the error message span to include the full string literal since I figured the start of the token was the issue, while the help suggestion span would include up to the closing quotation mark. The look ahead logic does not affect the reader position, not sure if that is an issue (if eg it should still continue to parse after the closing quote without erroring out).
Special suggestion for illegal unicode curly quote pairs Fixes rust-lang#58436 Did not end up expanding the error message span to include the full string literal since I figured the start of the token was the issue, while the help suggestion span would include up to the closing quotation mark. The look ahead logic does not affect the reader position, not sure if that is an issue (if eg it should still continue to parse after the closing quote without erroring out).
Special suggestion for illegal unicode curly quote pairs Fixes rust-lang#58436 Did not end up expanding the error message span to include the full string literal since I figured the start of the token was the issue, while the help suggestion span would include up to the closing quotation mark. The look ahead logic does not affect the reader position, not sure if that is an issue (if eg it should still continue to parse after the closing quote without erroring out).
When encountering curly quotes, the compiler now points at the opening one suggesting changing it for a regular straight quote. It should also look ahead looking for a closing curly quote char and suggest changing that one too, because when fixing only the first one, the parser will interpret this as an unclosed string.
After applying suggestion:
Ideally
The text was updated successfully, but these errors were encountered: