about summary refs log tree commit diff
path: root/src/libsyntax/parse/parser.rs
AgeCommit message (Collapse)AuthorLines
2019-04-25ignore-tidy-filelength on all files with greater than 3000 linesvarkor-0/+2
2019-04-24Rollup merge of #60186 - estebank:accept-suffix, r=nikomatsakisMazdak Farrokhzad-3/+31
Temporarily accept [i|u][32|size] suffixes on a tuple index and warn Fix #60138. #59553 will need to be kept open to track the change back to rejecting this code a few versions down thee line.
2019-04-23review comment: change linked ticketEsteban Küber-1/+1
2019-04-23Rollup merge of #59823 - davidtwco:issue-54716, r=cramertjMazdak Farrokhzad-9/+78
[wg-async-await] Drop `async fn` arguments in async block Fixes #54716. This PR modifies the HIR lowering (and some other places to make this work) so that unused arguments to a async function are always dropped inside the async move block and not at the end of the function body. ``` async fn foo(<pattern>: <type>) { async move { } } // <-- dropped as you "exit" the fn // ...becomes... fn foo(__arg0: <ty>) { async move { let <pattern>: <ty> = __arg0; } // <-- dropped as you "exit" the async block } ``` However, the exact ordering of drops is not the same as a regular function, [as visible in this playground example](https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=be39af1a58e5d430be1eb3c722cb1ec3) - I believe this to be an unrelated issue. There is a [Zulip topic](https://rust-lang.zulipchat.com/#narrow/stream/187312-t-compiler.2Fwg-async-await/topic/.2354716.20drop.20order) for this. r? @cramertj cc @nikomatsakis
2019-04-22Temporarily accept [i|u][32|size] suffixes on a tuple index and warnEsteban Küber-3/+31
2019-04-21Introduce `ArgSource` for diagnostics.David Wood-4/+6
This commit introduces an `ArgSource` enum that is lowered into the HIR so that diagnostics can correctly refer to the argument pattern's original name rather than the generated pattern.
2019-04-21Do not specify type in generated let bindings.David Wood-6/+7
This avoids issues with `impl_trait_in_bindings` as the type from the argument is normally used as the let binding, but `impl Trait` is unstable in binding position.
2019-04-21Add `AsyncArgument` to AST.David Wood-4/+69
This commit adds an `AsyncArgument` struct to the AST that contains the generated argument and statement that will be used in HIR lowering, name resolution and def collection.
2019-04-21Auto merge of #60124 - petrochenkov:stanomut, r=eddybbors-1/+1
Remove mutability from `Def::Static` Querify `TyCtxt::is_static`. Use `Mutability` instead of bool in foreign statics in AST/HIR. cc https://github.com/rust-lang/rust/pull/60110 r? @eddyb
2019-04-21AST/HIR: Use `Mutability` instead of bool in foreign staticsVadim Petrochenkov-1/+1
2019-04-21Auto merge of #60119 - estebank:bad-recovery, r=davidtwcobors-1/+1
Remove assumption from recovery code Fix #60115.
2019-04-21Introduce `LocalSource` into the AST.David Wood-1/+2
This will be used to keep track of the origin of a local in the AST. In particular, it will be used by `async fn` lowering for the locals in `let <pat>: <ty> = __arg0;` statements.
2019-04-21Auto merge of #60132 - davidtwco:issue-60075, r=estebankbors-1/+6
Fix fn front matter parsing ICE from invalid code. Fixes #60075. This PR fixes an "unreachable code" ICE that results from parsing invalid code where the compiler is expecting the next trait item declaration in the middle of the previous trait item due to extra closing braces. r? @estebank (thanks for the minimized test case)
2019-04-20Fix fn front matter parsing ICE from invalid code.David Wood-1/+6
This commit fixes an "unreachable code" ICE that results from parsing invalid code where the compiler is expecting the next trait item declaration in the middle of the previous trait item due to extra closing braces.
2019-04-19Remove assumption from recovery codeEsteban Küber-1/+1
2019-04-19Some cleanup to `maybe_parse_struct_expr`Vadim Petrochenkov-18/+13
2019-04-19remove duplicated code and simplify logicEsteban Küber-30/+31
2019-04-19Identify missing ambiguous case with best effort suggestionEsteban Küber-4/+4
2019-04-19Emit specific error for struct literal in conditionsEsteban Küber-5/+52
2019-04-12Rollup merge of #59866 - estebank:recover-missing-semi, r=petrochenkovMazdak Farrokhzad-0/+26
Recover from missing semicolon based on the found token When encountering one of a few keywords when a semicolon was expected, suggest the semicolon and recover: ``` error: expected one of `.`, `;`, `?`, or an operator, found `let` --> $DIR/recover-missing-semi.rs:4:5 | LL | let _: usize = () | - help: missing semicolon here LL | LL | let _ = 3; | ^^^ error[E0308]: mismatched types --> $DIR/recover-missing-semi.rs:2:20 | LL | let _: usize = () | ^^ expected usize, found () | = note: expected type `usize` found type `()` ```
2019-04-12Rollup merge of #59847 - Kampfkarren:try-block-catch, r=estebankMazdak Farrokhzad-1/+9
Error when using `catch` after `try` Part of https://github.com/rust-lang/rust/issues/31436
2019-04-11Auto merge of #59227 - Zoxc:fix-get, r=eddybbors-3/+5
Fix lifetime on LocalInternedString::get function cc @eddyb @nnethercote
2019-04-11review commentsEsteban Küber-16/+15
2019-04-10FeedbackKampfkarren-1/+2
2019-04-10Recover from missing semicolon based on the found tokenEsteban Küber-0/+27
When encountering one of a few keywords when a semicolon was expected, suggest the semicolon and recover: ``` error: expected one of `.`, `;`, `?`, or an operator, found `let` --> $DIR/recover-missing-semi.rs:4:5 | LL | let _: usize = () | - help: missing semicolon here LL | LL | let _ = 3; | ^^^ error[E0308]: mismatched types --> $DIR/recover-missing-semi.rs:2:20 | LL | let _: usize = () | ^^ expected usize, found () | = note: expected type `usize` found type `()` ```
2019-04-10Adhere to tidy scriptKampfkarren-1/+2
2019-04-10Special error when using catch after tryKampfkarren-1/+7
2019-04-01Rollup merge of #59041 - saleemjaffer:trait_doc_comment_better_error_msg, ↵Mazdak Farrokhzad-0/+16
r=pnkfelix fixes rust-lang#56766 fixes #56766
2019-03-31Fix lifetime on LocalInternedString::get functionJohn Kåre Alsaker-3/+5
2019-03-30Rollup merge of #59453 - estebank:recover-tuple-parse, r=petrochenkovMazdak Farrokhzad-26/+57
Recover from parse error in tuple syntax
2019-03-28Deduplicate parse recovery codeEsteban Küber-35/+43
2019-03-28Recover from parse error in tuple syntaxEsteban Küber-8/+31
2019-03-28Rollup merge of #59198 - estebank:recovered-pattern, r=zackmdavisMazdak Farrokhzad-1/+1
Do not complain about unmentioned fields in recovered patterns When the parser has to recover from malformed code in a pattern, do not complain about missing fields. Fix #59145.
2019-03-27Rollup merge of #59421 - estebank:tuple-index-suffix, r=petrochenkovJosh Stone-50/+52
Reject integer suffix when tuple indexing Fix #59418. r? @varkor
2019-03-27Rollup merge of #57565 - petrochenkov:turbowarn, r=CentrilJosh Stone-21/+10
syntax: Remove warning for unnecessary path disambiguators `rustfmt` is now stable and it removes unnecessary turbofishes, so removing the warning as discussed in https://github.com/rust-lang/rust/pull/43540 (where it was introduced). One hardcoded warning less. Closes https://github.com/rust-lang/rust/issues/58055 r? @nikomatsakis
2019-03-26Add specific message for tuple struct invoked with suffixed numeric field nameEsteban Küber-1/+2
2019-03-26Reword invalid suffixe errorsEsteban Küber-7/+6
2019-03-26Use `expect_no_suffix` for errorEsteban Küber-8/+1
2019-03-26Rollup merge of #59150 - estebank:type-ascription, r=varkorMazdak Farrokhzad-13/+62
Expand suggestions for type ascription parse errors Fix #51222. CC #48016, #47666, #54516, #34255.
2019-03-25review commentsEsteban Küber-1/+1
2019-03-25Reject integer suffix when tuple indexingEsteban Küber-43/+52
2019-03-24Separate variant id and variant constructor id.David Wood-5/+6
This commit makes two changes - separating the `NodeId` that identifies an enum variant from the `NodeId` that identifies the variant's constructor; and no longer creating a `NodeId` for `Struct`-style enum variants and structs. Separation of the variant id and variant constructor id will allow the rest of RFC 2008 to be implemented by lowering the visibility of the variant's constructor without lowering the visbility of the variant itself. No longer creating a `NodeId` for `Struct`-style enum variants and structs mostly simplifies logic as previously this `NodeId` wasn't used. There were various cases where the `NodeId` wouldn't be used unless there was an unit or tuple struct or enum variant but not all uses of this `NodeId` had that condition, by removing this `NodeId`, this must be explicitly dealt with. This change mostly applied cleanly, but there were one or two cases in name resolution and one case in type check where the existing logic required a id for `Struct`-style enum variants and structs.
2019-03-23Tweak unsupported negative trait bounds messageEsteban Küber-7/+14
2019-03-23syntax: Remove warning for unnecessary path disambiguatorsVadim Petrochenkov-21/+10
2019-03-23Auto merge of #59058 - petrochenkov:assocrecov3, r=estebankbors-88/+82
syntax: Better recovery for `$ty::AssocItem` and `ty!()::AssocItem` This PR improves on https://github.com/rust-lang/rust/pull/46788 covering a few missing cases. Fixes https://github.com/rust-lang/rust/issues/52307 Fixes https://github.com/rust-lang/rust/issues/53776 r? @estebank
2019-03-22Reword type ascription note to reduce verbosityEsteban Küber-5/+1
2019-03-22Review commentEsteban Küber-2/+2
2019-03-22Expand suggestions for type ascription parse errorsEsteban Küber-13/+66
2019-03-22Rollup merge of #59322 - estebank:diag-tweak, r=davidtwcoMazdak Farrokhzad-4/+9
Tweak incorrect escaped char diagnostic
2019-03-22Rollup merge of #59266 - estebank:struct-parse-recovery, r=petrochenkovMazdak Farrokhzad-10/+20
Do not complain about non-existing fields after parse recovery When failing to parse struct-like enum variants, the ADT gets recorded as having no fields. Record that we have actually recovered during parsing of this variant to avoid complaing about non-existing fields when actually using it. Fix #57361.