about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
2019-06-18Remove the HirId/NodeId from where clausesMatthew Jasper-2/+0
Also give them a span in the HIR
2019-06-12Auto merge of #61612 - nnethercote:improve-parse_bottom_expr, r=petrochenkovbors-10/+22
Special-case literals in `parse_bottom_expr`. This makes parsing faster, particularly for code with large constants, for two reasons: - it skips all the keyword comparisons for literals; - it skips the allocation done by the `mk_expr` call in `parse_literal_maybe_minus`. r? @petrochenkov
2019-06-12Auto merge of #60669 - c410-f3r:attrs-fn, r=petrochenkovbors-28/+52
Allow attributes in formal function parameters Implements https://github.com/rust-lang/rust/issues/60406. This is my first contribution to the compiler and since this is a large and complex project, I am not fully aware of the consequences of the changes I have made. **TODO** - [x] Forbid some built-in attributes. - [x] Expand cfg/cfg_attr
2019-06-10Special-case literals in `parse_bottom_expr`.Nicholas Nethercote-10/+22
This makes parsing faster, particularly for code with large constants, for two reasons: - it skips all the keyword comparisons for literals; - it replaces the unnecessary `parse_literal_maybe_minus` call with `parse_lit`, avoiding an unnecessary allocation via `mk_expr`.
2019-06-09Allow attributes in formal function parametersCaio-28/+52
2019-06-08syntax: Remove `Deref` impl from `Token`Vadim Petrochenkov-9/+9
2019-06-08syntax: Move most of the `TokenKind` methods to `Token`Vadim Petrochenkov-3/+5
2019-06-07parser: Remove `look_ahead_span`Vadim Petrochenkov-13/+1
2019-06-07parser: Remove `Deref` impl from `Parser`Vadim Petrochenkov-10/+0
2019-06-07parser: `self.span` -> `self.token.span`Vadim Petrochenkov-179/+192
2019-06-06Address review commentsVadim Petrochenkov-4/+8
2019-06-06Some code cleanup and tidy/test fixesVadim Petrochenkov-25/+30
2019-06-06syntax: Switch function parameter order in `TokenTree::token`Vadim Petrochenkov-7/+7
2019-06-06syntax: Remove duplicate span from `token::Ident`Vadim Petrochenkov-27/+21
2019-06-06syntax: Remove duplicate span from `token::Lifetime`Vadim Petrochenkov-4/+3
2019-06-06syntax: Add some helper methods to `Token`Vadim Petrochenkov-10/+10
2019-06-06syntax: Use `Token` in `Parser`Vadim Petrochenkov-79/+82
2019-06-06syntax: Use `Token` in `TokenTree::Token`Vadim Petrochenkov-10/+10
2019-06-06syntax: Rename `TokenAndSpan` into `Token`Vadim Petrochenkov-15/+15
2019-06-06syntax: Rename `Token` into `TokenKind`Vadim Petrochenkov-24/+24
2019-06-06Always use token kinds through `token` module rather than `Token` typeVadim Petrochenkov-4/+4
2019-06-05Implemented for function bounds, type bounds, and named existential types.Alexander Regueiro-21/+31
2019-06-05Aggregation of drive-by cosmetic changes.Alexander Regueiro-29/+29
2019-06-05Auto merge of #61484 - nnethercote:avoid-more-hygiene-lookups, r=petrochenkovbors-8/+11
Avoid more hygiene lookups Mostly by combining multiple `HygieneData::with` calls into a single call on hot paths. r? @petrochenkov
2019-06-05Avoid unnecessary `rust_2018` calls.Nicholas Nethercote-8/+11
The commit combines two calls into one by saving the result in a local variable. The commit also moves the check for `async` later, so that when a different keyword is present the `rust_2018` call will be avoided completely.
2019-06-04Rollup merge of #61500 - estebank:expregression, r=petrochenkovPietro Albini-7/+11
Fix regression 61475 Addresses #61475.
2019-06-04Rollup merge of #61413 - davidtwco:async-argument-order-in-a-sane-way, r=eddybMazdak Farrokhzad-129/+12
Re-implement async fn drop order lowering This PR re-implements the async fn drop order lowering changes so that it all takes place in HIR lowering, building atop the work done by @eddyb to refactor `Res::Upvar`. Previously, this types involved in the lowering were constructed in libsyntax as they had to be used during name resolution and HIR lowering. This was awful because none of that logic should have existed in libsyntax. This commit also changes `ArgSource` to keep a `HirId` to the original argument pattern rather than a cloned copy of the pattern. Only b7aa4ed and 71fb8fa should be reviewed, any other commits are from #61276 (though 447e336 might end up staying in this PR). As a nice side effect, it also fixes #61187 (cc #61192). r? @eddyb cc @cramertj
2019-06-04Rollup merge of #61409 - varkor:condition-trait-param-ice, r=oli-obkMazdak Farrokhzad-3/+7
Fix an ICE with a const argument in a trait This goes some way towards fixing https://github.com/rust-lang/rust/issues/61383 (the reduced test case is fixed).
2019-06-03Fix regression #61475Esteban Küber-7/+11
2019-06-03syntax: revert `ast::AsyncArgument` and associated changes.Eduard-Mihai Burtescu-129/+12
Here follows the main reverts applied in order to make this commit: Revert "Rollup merge of #60676 - davidtwco:issue-60674, r=cramertj" This reverts commit 45b09453dbf120cc23d889435aac3ed7d2ec8eb7, reversing changes made to f6df1f6c30b469cb9e65c5453a0efa03cbb6005e. Revert "Rollup merge of #60437 - davidtwco:issue-60236, r=nikomatsakis" This reverts commit 16939a50ea440e72cb6ecefdaabb988addb1ec0e, reversing changes made to 12bf98155249783583a91863c5dccf9e346f1226. Revert "Rollup merge of #59823 - davidtwco:issue-54716, r=cramertj" This reverts commit 62d1574876f5531bce1b267e62dff520d7adcbbb, reversing changes made to 4eff8526a789e0dfa8b97f7dec91b7b5c18e8544.
2019-06-03Allow `true` and `false` in const generic argumentsvarkor-3/+7
2019-06-03Auto merge of #61331 - estebank:fn-arg-parse-recovery, r=varkorbors-21/+17
Recover gracefully from argument with missing type or param name
2019-06-02Rollup merge of #61438 - estebank:generics-span, r=varkorMazdak Farrokhzad-12/+13
Point at individual type args on arg count mismatch - Point at individual type arguments on arg count mismatch - Make generics always have a valid span, even when there are no args - Explain that `impl Trait` introduces an implicit type argument Fix #55991.
2019-05-31Make generics always have a valid spanEsteban Küber-12/+13
2019-05-30Move code from `parser` to `diagnostics`Esteban Küber-33/+2
2019-05-30Remove `ArgSource::Recovery`Esteban Küber-3/+3
2019-05-30Recover gracefully from argument with missing type or param nameEsteban Küber-9/+36
2019-05-31Parse 'async unsafe fn' instead of 'unsafe async fn'.Mazdak Farrokhzad-37/+34
2019-05-29libsyntax: introduce 'fn is_keyword_ahead(dist, keywords)'.Mazdak Farrokhzad-35/+38
2019-05-27Use `Symbol` equality in `is_ident_named`.Nicholas Nethercote-3/+3
2019-05-27Avoid unnecessary internings.Nicholas Nethercote-1/+1
Most involving `Symbol::intern` on string literals.
2019-05-25review comments: move back some methods and clean up wordingEsteban Küber-132/+31
2019-05-25Move some methods to `diagnostics.rs` away from `parser.rs`Esteban Küber-406/+33
Move a bunch of error recovery methods to `diagnostics.rs` away from `parser.rs`.
2019-05-25Tweak `self` arg not as first argument of a method diagnosticEsteban Küber-37/+10
Mention that `self` is only valid on "associated functions" ``` error: unexpected `self` argument in function --> $DIR/self-in-function-arg.rs:1:15 | LL | fn foo(x:i32, self: i32) -> i32 { self } | ^^^^ not valid as function argument | = note: `self` is only valid as the first argument of an associated function ``` When it is a method, mention it must be first ``` error: unexpected `self` argument in function --> $DIR/trait-fn.rs:4:20 | LL | fn c(foo: u32, self) {} | ^^^^ must be the first associated function argument ```
2019-05-24Move diagnostic logic out of parserEsteban Küber-19/+1
2019-05-24review commentsEsteban Küber-50/+7
2019-05-24Tweak macro parse errors when reaching EOF during macro call parseEsteban Küber-33/+58
- Add detail on origin of current parser when reaching EOF and stop saying "found <eof>" and point at the end of macro calls - Handle empty `cfg_attr` attribute - Reword empty `derive` attribute error
2019-05-24Auto merge of #60803 - varkor:remove-in-place-syntax, r=petrochenkovbors-16/+0
Remove `ObsoleteInPlace` The in place syntax has been deprecated for over a year. As it is, this is accumulated cruft: the error messages are unlikely to be helpful any more and it conflicts with some useful syntax (e.g. const generics in some instances). It may be that removing `Token::LArrow` is backwards-incompatible. We should do a crater run to check. cc @eddyb
2019-05-24Auto merge of #60984 - matthewjasper:borrowck-error-reporting-cleanup, ↵bors-4/+5
r=pnkfelix Borrowck error reporting cleanup * Don't show variables created by desugarings in borrowck errors * Move "conflict error" reporting to it's own module, so that `error_reporting` contains only common error reporting methods. * Remove unused `ScopeTree` parameter. r? @pnkfelix
2019-05-24Remove `ObsoleteInPlace`varkor-16/+0