about summary refs log tree commit diff
path: root/compiler/rustc_parse/src
AgeCommit message (Collapse)AuthorLines
2020-09-15Auto merge of #76171 - estebank:turbofish-the-revenge, r=davidtwcobors-6/+66
Detect turbofish with multiple type params missing leading `::` Fix #76072.
2020-09-14Detect turbofish with multiple type params missing leading `::`Esteban Küber-6/+66
Fix #76072.
2020-09-13Auto merge of #76598 - ad-anssi:diagnostic_errors_fix, r=estebankbors-1/+5
Fixing memory exhaustion when formatting short code suggestion Details can be found in issue #76597. This PR replaces substractions with `saturating_sub`'s to avoid usize wrapping leading to memory exhaustion when formatting short suggestion messages.
2020-09-13Auto merge of #76585 - Aaron1011:ignore-vert-plus, r=petrochenkovbors-0/+6
Ignore `|` and `+` tokens during proc-macro pretty-print check Fixes #76182 This is an alternative to PR #76188 These tokens are not preserved in the AST in certain cases (e.g. a leading `|` in a pattern or a trailing `+` in a trait bound). This PR ignores them entirely during the pretty-print/reparse check to avoid spuriously using the re-parsed tokenstream.
2020-09-11repairing broken error message and rustfix application for the new testAurélien Deharbe-1/+5
case
2020-09-10Attach tokens to `ast::Stmt`Aaron Hill-5/+22
We currently only attach tokens when parsing a `:stmt` matcher for a `macro_rules!` macro. Proc-macro attributes on statements are still unstable, and need additional work.
2020-09-10Attach `TokenStream` to `ast::Visibility`Aaron Hill-12/+40
A `Visibility` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Attach `TokenStream` to `ast::Path`Aaron Hill-6/+18
2020-09-10Attach tokens to `NtMeta` (`ast::AttrItem`)Aaron Hill-2/+10
An `AttrItem` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Collect tokens when handling `:literal` matcherAaron Hill-2/+10
An `NtLiteral` just wraps an `Expr`, so we don't need to add a new `tokens` field to an AST struct.
2020-09-10Attach `TokenStream` to `ast::Ty`Aaron Hill-6/+24
A `Ty` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Attach `TokenStream` to `ast::Block`Aaron Hill-2/+10
A `Block` does not have outer attributes, so we only capture tokens when parsing a `macro_rules!` matcher
2020-09-10Ignore `|` and `+` tokens during proc-macro pretty-print checkAaron Hill-0/+6
Fixes #76182 This is an alternative to PR #76188 These tokens are not preserved in the AST in certain cases (e.g. a leading `|` in a pattern or a trailing `+` in a trait bound). This PR ignores them entirely during the pretty-print/reparse check to avoid spuriously using the re-parsed tokenstream.
2020-09-10Rollup merge of #76563 - yokodake:patch-1, r=jonas-schievinkTyler Mandry-1/+1
small typo fix in rustc_parse docs small typo in rustc_parse::new_parser_from_file's documentation I'm not sure a PR is the way to do this though.
2020-09-10Syntactically permit unsafety on modsDavid Tolnay-16/+51
2020-09-10small typo fix in rustc_parse docsNanami-1/+1
2020-09-10Revert "Rollup merge of #76285 - matklad:censor-spacing, r=petrochenkov"Tyler Mandry-6/+9
This reverts commit 85cee57fd791d670d92dc61e0ad71594128dd45a, reversing changes made to b4d387302416c90a3f70211770292d8d8ab5e07d.
2020-09-03Optimize Cursor::look_aheadAleksey Kladov-5/+5
Cloning a tt is cheap, but not free (there's Arc inside).
2020-09-03Rename IsJoint -> SpacingAleksey Kladov-25/+25
To match better naming from proc-macro
2020-09-03Condense StringReader's API to a single functionAleksey Kladov-33/+25
2020-09-03Move jointness censoring to proc_macroAleksey Kladov-4/+1
Proc-macro API currently exposes jointness in `Punct` tokens. That is, `+` in `+one` is **non** joint. Our lexer produces jointness info for all tokens, so we need to censor it *somewhere* Previously we did this in a lexer, but it makes more sense to do this in a proc-macro server.
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