about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
AgeCommit message (Collapse)AuthorLines
2020-09-02Auto merge of #76160 - scileo:format-recovery, r=petrochenkovbors-0/+4
Improve recovery on malformed format call The token following a format expression should be a comma. However, when it is replaced with a similar token (such as a dot), then the corresponding error is emitted, but the token is treated as a comma, and the parsing step continues. r? @petrochenkov
2020-09-02Improve recovery on malformed format callSasha-0/+4
If a comma in a format call is replaced with a similar token, then we emit an error and continue parsing, instead of stopping at this point.
2020-09-02Auto merge of #76170 - matklad:notrivia, r=petrochenkovbors-91/+67
Remove trivia tokens r? @ghost
2020-09-01Rollup merge of #76132 - Aaron1011:mac-call-stmt, r=petrochenkovTyler Mandry-2/+2
Factor out StmtKind::MacCall fields into `MacCallStmt` struct In PR #76130, I add a fourth field, which makes using a tuple variant somewhat unwieldy.
2020-09-01Simplify TokenTreesReaderAleksey Kladov-11/+11
This `joint_to_prev` bit of state is no longer needed.
2020-09-01Remove trivia tokensAleksey Kladov-8/+1
2020-09-01Don't emit trivia tokensAleksey Kladov-73/+56
2020-08-31Make StringReader privateAleksey Kladov-3/+3
After the recent refactorings, we can actually completely hide this type. It should help with #63689.
2020-08-31Rollup merge of #76115 - calebcartwright:parser-fn-visibility, r=matkladAleksey Kladov-2/+4
Restore public visibility on some parsing functions for rustfmt In #74826 the visibility of several parsing functions was reduced. However, rustfmt is an external consumer of some of these functions as well and needs the visibility to be public, similar to other elements in rustc_parse such as `parse_ident` https://github.com/rust-lang/rust/blob/db534b3ac286cf45688c3bbae6aa6e77439e52d2/src/librustc_parse/parser/mod.rs#L433-L436
2020-08-31Rollup merge of #76050 - matklad:pos, r=petrochenkovAleksey Kladov-4/+0
Remove unused function
2020-08-30Factor out StmtKind::MacCall fields into `MacCallStmt` structAaron Hill-2/+2
In PR #76130, I add a fourth field, which makes using a tuple variant somewhat unwieldy.
2020-08-30Use string literal directly when available in formatSasha-1/+1
Previous implementation used the `Parser::parse_expr` function in order to extract the format expression. If the first comma following the format expression was mistakenly replaced with a dot, then the next format expression was eaten by the function, because it looked as a syntactically valid expression, which resulted in incorrectly spanned error messages. The way the format expression is exctracted is changed: we first look at the first available token in the first argument supplied to the `format!` macro call. If it is a string literal, then it is promoted as a format expression immediatly, otherwise we fall back to the original `parse_expr`-related method. This allows us to ensure that the parser won't consume too much tokens when a typo is made. A test has been created so that it is ensured that the issue is properly fixed.
2020-08-30parser: restore some fn visibility for rustfmtCaleb Cartwright-2/+4
2020-08-30Remove unused functionAleksey Kladov-4/+0
2020-08-30mv compiler to compiler/mark-0/+12685