about summary refs log tree commit diff
path: root/src/libsyntax
AgeCommit message (Collapse)AuthorLines
2019-05-13Pass a `Symbol` to `check_name`, `emit_feature_err`, and related functions.Nicholas Nethercote-166/+161
2019-05-13Rename `syntax::symbol::symbols` as `syntax::symbol::sym`.Nicholas Nethercote-132/+132
Because it's going to be used a lot.
2019-05-11Address comments + Fix testsVadim Petrochenkov-4/+9
2019-05-11Move literal parsing code into a separate fileVadim Petrochenkov-521/+505
Remove some dead code
2019-05-11Simplify conversions between tokens and semantic literalsVadim Petrochenkov-248/+241
2019-05-11Eliminate `comments::Literal`Vadim Petrochenkov-160/+44
2019-05-11Introduce `hir::Lit` not keeping the original tokenVadim Petrochenkov-1/+1
2019-05-11Keep the original token in `ast::Lit`Vadim Petrochenkov-42/+66
2019-05-11Turn `ast::Lit` into a structVadim Petrochenkov-16/+19
2019-05-10turn a couple of fixmes into span_bugsMark Mansi-9/+7
2019-05-09Rollup merge of #60676 - davidtwco:issue-60674, r=cramertjMazdak Farrokhzad-10/+38
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 #60618 - mark-i-m:transcribe, r=petrochenkovMazdak Farrokhzad-69/+194
Comment ext::tt::transcribe Also did a bit of minor cleanup (remove unidiomatic use of `Add` and an unneeded `clone`). No functionality changes. r? @petrochenkov
2019-05-09Rollup merge of #60188 - estebank:recover-block, r=varkorMazdak Farrokhzad-7/+101
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/+34
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-08fix incorrect assertMark Mansi-1/+4
2019-05-07lots of comments + minor cleanupMark Mansi-16/+139
2019-05-07avoid extra copyMark Mansi-13/+12
2019-05-07Auto merge of #60586 - cramertj:await, r=oli-obkbors-0/+70
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/+70
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-07Auto merge of #60464 - eddyb:not-overly-specific-pipelining, r=alexcrichtonbors-6/+7
rustc: rename -Z emit-directives to -Z emit-artifact-notifications and simplify the output. This is my take on #60006 / #60419 (see https://github.com/rust-lang/rust/pull/60006#discussion_r275983732). I'm not too attached the "notifications" part, it's pretty much bikeshed material. **EDIT**: for "artifact", @matklad pointed out Cargo already uses it (in https://github.com/rust-lang/rust/pull/60464#issuecomment-488576998) The first two commits are fixes that could be landed independently, especially the `compiletest` one, which removes the need for any of the normalization added in #60006 to land the test. The last commit enables the emission for all outputs, which was my main suggestion for #60006, mostly to show that it's minimal and not really a "scope creep" (as suggested in https://github.com/rust-lang/rust/pull/60006#discussion_r279964081). cc @alexcrichton @nnethercote
2019-05-07rustc: rename -Z emit-directives to -Z emit-artifact-notifications and ↵Eduard-Mihai Burtescu-6/+7
simplify the output.
2019-05-07Auto merge of #60531 - Centril:sort-features, r=oli-obkbors-16/+39
Enforce sorting of accepted and removed features Fixes https://github.com/rust-lang/rust/issues/60361 with mechanism introduced in https://github.com/rust-lang/rust/pull/60373. r? @oli-obk
2019-05-06review comments: fix typo and add commentsEsteban Küber-8/+14
2019-05-06rustfmtMark Mansi-50/+50
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-06Auto merge of #60261 - matklad:one-escape, r=petrochenkovbors-665/+905
introduce unescape module A WIP PR to gauge early feedback Currently, we deal with escape sequences twice: once when we [lex](https://github.com/rust-lang/rust/blob/112f7e9ac564e2cfcfc13d599c8376a219fde1bc/src/libsyntax/parse/lexer/mod.rs#L928-L1065) a string, and a second time when we [unescape](https://github.com/rust-lang/rust/blob/112f7e9ac564e2cfcfc13d599c8376a219fde1bc/src/libsyntax/parse/mod.rs#L313-L366) literals. Note that we also produce different sets of diagnostics in these two cases. This PR aims to remove this duplication, by introducing a new `unescape` module as a single source of truth for character escaping rules. I think this would be a useful cleanup by itself, but I also need this for https://github.com/rust-lang/rust/pull/59706. In the current state, the PR has `unescape` module which fully (modulo bugs) deals with string and char literals. I am quite happy about the state of this module What this PR doesn't have yet are: * [x] handling of byte and byte string literals (should be simple to add) * [x] good diagnostics * [x] actual removal of code from lexer (giant `scan_char_or_byte` should go away completely) * [x] performance check * [x] general cleanup of the new code Diagnostics will be the most labor-consuming bit here, but they are mostly a question of just correctly adjusting spans to sub-tokens. The current setup for diagnostics is that `unescape` produces a plain old `enum` with various problems, and they are rendered into `Handler` separately. This bit is not actually required (it is possible to just pass the `Handler` in), but I like the separation between diagnostics and logic this approach imposes, and such separation should again be useful for #59706 cc @eddyb , @petrochenkov
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-04Rename 'no tracking issue START' to fit better with tidy.Mazdak Farrokhzad-8/+8
2019-05-04Enforce sorting of accepted and removed features.Mazdak Farrokhzad-8/+31
2019-05-03Rollup merge of #60501 - taiki-e:async-await-mutable-arguments, r=cramertjMazdak Farrokhzad-6/+4
Propagate mutability from arguments to local bindings in async fn Fixes #60498 cc @nikomatsakis r? @davidtwco
2019-05-03Propagate mutability from arguments to local bindings in async fnTaiki Endo-6/+4
2019-05-02Deduplicate needed parentheses suggestion codeEsteban Küber-24/+28
2019-05-02fix typoEsteban Küber-4/+4
2019-05-02don't amplify errors in format! with bad literalsAleksey Kladov-7/+15
2019-05-02Group and sort feature_gate.rsAlexey Shmalko-11/+22
2019-05-02introduce unescape moduleAleksey Kladov-665/+897
Currently, we deal with escape sequences twice: once when we lex a string, and a second time when we unescape literals. This PR aims to remove this duplication, by introducing a new `unescape` mode as a single source of truth for character escaping rules
2019-05-02Rollup merge of #60437 - davidtwco:issue-60236, r=nikomatsakisMazdak Farrokhzad-23/+72
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-02Rollup merge of #60348 - agnxy:refactor-parser, r=petrochenkovMazdak Farrokhzad-162/+231
move some functions from parser.rs to diagostics.rs Starting with a few functions mentioned in https://github.com/rust-lang/rust/issues/60015#issuecomment-484259773. We might refactor parser.rs further in subsequent changes. r? @petrochenkov
2019-05-02Rollup merge of #59634 - DevQps:explain-E0704, r=estebankMazdak Farrokhzad-1/+29
Added an explanation for the E0704 error. # Description Adds an explanation on the E0704 error. I tried to stick as closely to the message that the compiler generates. It's the first time I am fixing error messages here, so if there is something I did wrong or should improve, please let me know. closes #55398
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.
2019-05-01Ensure that drop order of `async fn` matches `fn`.David Wood-22/+71
This commit 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.
2019-05-01move some functions from parser.rs to diagostics.rsAndrew Xu-162/+231
parser.rs is too big. Some functions only for error reporting and error recovery are being moved to diagostics.rs.
2019-05-01Added the E0704 error with a link to the Rust reference.Christian-1/+29
2019-04-30Reword ambigous parse error to fit with the current errorEsteban Küber-5/+6