You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Lookahead for closing curly quote when encountering opening curly quote #58436
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.
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.
fn main() {
println!(“”);
}
error: unknown start of token: \u{201c}
--> src/main.rs:2:14
|
2 | println!(“”);
| ^
help: Unicode character '“' (Left Double Quotation Mark) looks like '"' (Quotation Mark), but it is not
|
2 | println!("”);
| ^
It should be possible to special case the “ char to continue advancing, using self.nextch() I think, until finding a ”, and if found, add that to the diagnostic.
The Forge has info on setting up the repo and building your own rustc. The workflow is usually running ./x.py test src/test/ui --stage 1 --bless and modifying/creating test files in src/test/ui.
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`C-enhancementCategory: An issue proposing an enhancement or a PR with one.
Activity
pmccarter commentedon Feb 13, 2019
I could maybe do this with some mentoring, if not too difficult or trivial...
estebank commentedon Feb 13, 2019
@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
“char to continue advancing, usingself.nextch()I think, until finding a”, and if found, add that to the diagnostic.The Forge has info on setting up the repo and building your own
rustc. The workflow is usually running./x.py test src/test/ui --stage 1 --blessand modifying/creating test files insrc/test/ui.Rollup merge of rust-lang#58526 - pmccarter:master, r=estebank
Rollup merge of rust-lang#58526 - pmccarter:master, r=estebank
Rollup merge of rust-lang#58526 - pmccarter:master, r=estebank
Rollup merge of rust-lang#58526 - pmccarter:master, r=estebank