about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
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
2019-05-12parse_bottom_expr: extract common 'return' out.Mazdak Farrokhzad-6/+5
2019-05-12syntax::parse::parser: convert unnecessary '&mut self's to '&self'.Mazdak Farrokhzad-19/+19
2019-05-12syntax: Remove some legacy nonterminal tokensVadim Petrochenkov-8/+0
2019-05-11Move literal parsing code into a separate fileVadim Petrochenkov-51/+5
Remove some dead code
2019-05-11Simplify conversions between tokens and semantic literalsVadim Petrochenkov-116/+37
2019-05-11Eliminate `comments::Literal`Vadim Petrochenkov-5/+5
2019-05-11Keep the original token in `ast::Lit`Vadim Petrochenkov-15/+15
2019-05-11Turn `ast::Lit` into a structVadim Petrochenkov-4/+3
2019-05-10Include expression to wait for to the span of Awaittopecongiro-0/+1
2019-05-09Rollup merge of #60676 - davidtwco:issue-60674, r=cramertjMazdak Farrokhzad-10/+17
Fix async desugaring providing wrong input to procedural macros. Fixes #60674. This PR fixes a minor oversight introduced by #60535 where unused `mut` binding modes were removed from the arguments to an `async fn` (as they were added to the statement that we insert into the closure body). However, this meant that the input to procedural macros was incorrect. This removes that and instead fixes the `unused_mut` error that it avoided. r? @cramertj cc @taiki-e
2019-05-09Rollup merge of #60188 - estebank:recover-block, r=varkorMazdak Farrokhzad-4/+49
Identify when a stmt could have been parsed as an expr There are some expressions that can be parsed as a statement without a trailing semicolon depending on the context, which can lead to confusing errors due to the same looking code being accepted in some places and not others. Identify these cases and suggest enclosing in parenthesis making the parse non-ambiguous without changing the accepted grammar. Fix #54186, cc #54482, fix #59975, fix #47287.
2019-05-09Add FIXME about `construct_async_arguments`.David Wood-0/+4
This is unrelated to the rest of this PR but it made sense to add a FIXME explaining that the function shouldn't really be in the parser.
2019-05-09Do not modify mutability of simple bindings.David Wood-10/+13
This commit removes the modification of the mutability of simple bindings. While the mutability isn't used, it is important that it is kept so that the input to procedural macros matches what the user wrote. This commit also modifies the span of the binding mode so that it is considered a compiler desugaring and won't be linted against for being unused..
2019-05-07Auto merge of #60586 - cramertj:await, r=oli-obkbors-0/+17
Implement built-in await syntax Adds support for .await under the existing async_await feature gate. Moves macro-like await! syntax to the await_macro feature gate. Removes support for `await` as a non-keyword under the `async_await` feature. This new syntax is not final, but is the consensus solution proposed by the lang team, as explained in https://boats.gitlab.io/blog/post/await-decision/ Fix https://github.com/rust-lang/rust/issues/51719 Fix https://github.com/rust-lang/rust/issues/51751 Fix https://github.com/rust-lang/rust/issues/60016
2019-05-07Implement built-in await syntaxTaylor Cramer-0/+17
Adds support for .await under the existing async_await feature gate. Moves macro-like await! syntax to the await_macro feature gate. Removes support for `await` as a non-keyword under the `async_await` feature.
2019-05-07Rollup merge of #60583 - varkor:const-generics-emplace, r=petrochenkovMazdak Farrokhzad-3/+2
Fix parsing issue with negative literals as const generic arguments
2019-05-07Rollup merge of #60535 - taiki-e:async-fn-arguments, r=cramertjMazdak Farrokhzad-11/+22
Correct handling of arguments in async fn Fixes #60509 Fixes #60566 r? @cramertj or @davidtwco
2019-05-06review comments: fix typo and add commentsEsteban Küber-4/+7
2019-05-06Remove resolved FIXMEvarkor-2/+0
2019-05-06`token::LArrow` can begin argumentsvarkor-1/+2
`<-` may indicate the start of a negative const argument.
2019-05-06Remove duplicate commentvarkor-4/+0
Co-Authored-By: Gabriel Smith <yodaldevoid@users.noreply.github.com>
2019-05-05Correct handling of arguments in async fnTaiki Endo-11/+22
2019-05-04Rollup merge of #60429 - estebank:pub-path, r=michaelwoeristerMazdak Farrokhzad-2/+4
Account for paths in incorrect pub qualifier help Handle case where incorrect pub qualifier with a mod path is used and provide the same help given for all other incorrect qualifiers by making the `pub(crate)` parse check more specific.
2019-05-03Propagate mutability from arguments to local bindings in async fnTaiki Endo-6/+4
2019-05-02Deduplicate needed parentheses suggestion codeEsteban Küber-23/+6
2019-05-02fix typoEsteban Küber-4/+4
2019-05-02Rollup merge of #60437 - davidtwco:issue-60236, r=nikomatsakisMazdak Farrokhzad-15/+49
Ensure that drop order of `async fn` matches `fn` and that users cannot refer to generated arguments. Fixes #60236 and fixes #60438. This PR modifies the lowering of `async fn` arguments so that the drop order matches the equivalent `fn`. Previously, async function arguments were lowered as shown below: async fn foo(<pattern>: <ty>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>) { async move { let <pattern> = __arg0; } // <-- dropped as you "exit" the async block } After this PR, async function arguments will be lowered as: async fn foo(<pattern>: <ty>, <pattern>: <ty>, <pattern>: <ty>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>, __arg1: <ty>, __arg2: <ty>) { async move { let __arg2 = __arg2; let <pattern> = __arg2; let __arg1 = __arg1; let <pattern> = __arg1; let __arg0 = __arg0; let <pattern> = __arg0; } // <-- dropped as you "exit" the async block } If `<pattern>` is a simple ident, then it is lowered to a single `let <pattern> = <pattern>;` statement as an optimization. This PR also stops users from referring to the generated `__argN` identifiers. r? @nikomatsakis
2019-05-01Ensure that users cannot use generated arguments.David Wood-1/+1
This commit gensyms the generated ident for replacement arguments so that users cannot refer to them. It also ensures that levenshtein distance suggestions do not suggest gensymed identifiers.