about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
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 #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-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
2019-05-24Rollup merge of #61056 - euclio:custom-discriminant-error, r=estebankMazdak Farrokhzad-13/+1
tweak discriminant on non-nullary enum diagnostic Adds notes pointing at the non-nullary variants, and uses "custom discriminant" language to be consistent with the Reference. Fixes #61039. r? @estebank
2019-05-23tweak discriminant on non-nullary enum diagnosticAndy Russell-13/+1
Adds notes pointing at the non-nullary variants, and uses "custom discriminant" language to be consistent with the Reference.
2019-05-23syntax: Turn `token::Lit` into a structVadim Petrochenkov-18/+23
2019-05-23syntax: Return named errors from literal parsing functionsVadim Petrochenkov-1/+1
2019-05-23Auto merge of #60174 - matthewjasper:add-match-arm-scopes, r=pnkfelixbors-0/+4
Add match arm scopes and other scope fixes * Add drop and lint scopes for match arms. * Lint attributes are now respected on match arms. * Make sure we emit a StorageDead if we diverge when initializing a temporary. * Adjust MIR pretty printing of scopes for locals. * Don't generate duplicate lint scopes for `let statements`. * Add some previously missing fake borrows for matches. closes #46525 cc @rust-lang/compiler
2019-05-22Eliminate unnecessary `Ident::with_empty_ctxt`sVadim Petrochenkov-10/+8
2019-05-22Simplify use of keyword symbolsVadim Petrochenkov-206/+209
2019-05-21Dont show variables from desugarings in borrowck errorsMatthew Jasper-4/+5
2019-05-21Give match arms an HirId and a SpanMatthew Jasper-0/+4
2019-05-18Auto merge of #60910 - nnethercote:avoid-some-unnecessary-interning, ↵bors-2/+3
r=petrochenkov Avoid some unnecessary interning r? @petrochenkov
2019-05-17Rollup merge of #60901 - estebank:str-str-str, r=CentrilManish Goregaokar-2/+1
Handle more string addition cases with appropriate suggestions
2019-05-17Avoid unnecessary interning in `Ident::from_str()` calls.Nicholas Nethercote-2/+3
A lot of these static symbols are pre-interned.
2019-05-16Fix binop spanEsteban Küber-2/+1
2019-05-16Move some parser recovery methods to diagnosticsEsteban Küber-261/+5
2019-05-16Fix span for await macro callEsteban Küber-1/+1
2019-05-16Review commentsEsteban Küber-95/+29
- Change wording of suggestion - Move recovery logic to `diagnostics.rs` - Reduce ammount of code duplication
2019-05-16Simplify span usage for incorrect awaitEsteban Küber-3/+3
2019-05-16Split parser logic to its own methodEsteban Küber-87/+96
2019-05-16Parse alternative incorrect uses of await and recoverEsteban Küber-8/+105
2019-05-16Rollup merge of #60691 - topecongiro:await-macro-span, r=CentrilMazdak Farrokhzad-0/+1
Include expression to wait for to the span of Await Currently the span of `await!` only includes itself: ```rust await!(3); // ^^^^^ ``` This PR changes it so that the span holds the whole `await!` expression: ```rust await!(3); // ^^^^^^^^^
2019-05-13Auto merge of #60630 - nnethercote:use-Symbol-more, r=petrochenkovbors-4/+4
Use `Symbol` more A `Symbol` can be equated with a string (e.g. `&str`). This involves a TLS lookup to get the chars (and a Mutex lock in a parallel compiler) and then a char-by-char comparison. This functionality is convenient but avoids one of the main benefits of `Symbol`s, which is fast equality comparisons. This PR removes the `Symbol`/string equality operations, forcing a lot of existing string occurrences to become `Symbol`s. Fortunately, these are almost all static strings (many are attribute names) and we can add static `Symbol`s as necessary, and very little extra interning occurs. The benefits are (a) a slight speedup (possibly greater in a parallel compiler), and (b) the code is a lot more principled about `Symbol` use. The main downside is verbosity, particularly with more `use syntax::symbol::symbols` items. r? @Zoxc
2019-05-13Remove the equality operation between `Symbol` and strings.Nicholas Nethercote-1/+1
And also the equality between `Path` and strings, because `Path` is made up of `Symbol`s.
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-3/+3
2019-05-12Auto merge of #60767 - Centril:rollup-4cbsb73, r=Centrilbors-57/+38
Rollup of 4 pull requests Successful merges: - #60694 (Fix HIR printing of existential type #60662) - #60750 (syntax: Remove some legacy nonterminal tokens) - #60751 (Assorted cleanup in parser & AST validation) - #60752 (Fix minor typos for ItemLocalId) Failed merges: r? @ghost
2019-05-12Rollup merge of #60751 - Centril:general-cleanup, r=petrochenkovMazdak Farrokhzad-49/+38
Assorted cleanup in parser & AST validation r? @petrochenkov Extracted out of a larger PR.
2019-05-12Minor cleanup in parse_assoc_expr_with.Mazdak Farrokhzad-24/+14