about summary refs log tree commit diff
path: root/src/test/ui/async-await
AgeCommit message (Collapse)AuthorLines
2019-09-22ignore-x86 instead of ignore-muslEsteban Küber-1/+1
2019-09-22ignore musl target in tests to avoid issues with output differencesEsteban Küber-6/+8
2019-09-22On obligation errors point at the unfulfilled binding when possibleEsteban Küber-5/+8
2019-09-20Auto merge of #64584 - nikomatsakis:issue-64477-generator-capture-types, r=eddybbors-0/+70
record fewer adjustment types in generator witnesses, avoid spurious drops in MIR construction Don't record all intermediate adjustment types -- That's way more than is needed, and winds up recording types that will never appear in MIR. Note: I'm like 90% sure that this logic is correct, but this stuff is subtle and can be hard to keep straight. However, the risk of this PR is fairly low -- if we miss types here, I believe the most common outcome is an ICE. This fixes the original issue cited by #64477, but I'm leaving the issue open for now since there may be other cases we can detect and improve in a targeted way. r? @Zoxc
2019-09-19fix tests for 2018Niko Matsakis-0/+4
2019-09-19avoid generating drops for moved operands of callsNiko Matsakis-0/+46
Currently, after a CALL terminator is created in MIR, we insert DROP statements for all of its operands -- even though they were just moved shortly before! These spurious drops are later removed, but not before causing borrow check errors. This PR series modifies the drop code to track operands that were moved and avoid creating drops for them. Right now, I'm only using this mechanism for calls, but it seems likely it could be used in more places.
2019-09-19Rollup merge of #64554 - lqd:polonius_tests4, r=nikomatsakisMazdak Farrokhzad-0/+16
Polonius: more `ui` test suite fixes Since #62736, new tests have been added, and the `run-pass` suite was merged into the `ui` suite. This PR adds the missing tests expectations for Polonius, and updates the existing ones where the NLL output has changed in some manner (e.g. ordering of notes) Those are the trivial cases, but a more-detailed explanation is available [in this write-up](https://hackmd.io/CjYB0fs4Q9CweyeTdKWyEg?both#26-async-awaitasync-borrowck-escaping-closure-errorrs-outputs-from-NLL-Polonius-diff) starting at test case 26: they are only differing in diagnostics and instances of other existing test cases differences. Only 3 of the 9020 tests are still "failing" at the moment (1 failure, 2 OOMs). r? @nikomatsakis
2019-09-18don't record all intermediate adjustment typesNiko Matsakis-0/+20
That's way more than is needed, and winds up recording types that will never appear in MIR.
2019-09-17Bless output of test borrowck/return-local-binding-from-desugaring.rs for ↵lqd-0/+16
Polonius
2019-09-17apply nits from centrilNiko Matsakis-7/+8
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-09-16add regression test for issue-64391Niko Matsakis-0/+14
2019-09-16add test for drop order of temporary in tail return expressionNiko Matsakis-0/+94
2019-09-10Rollup merge of #64292 - davidtwco:issue-63832-await-temporary-lifetimes, ↵Mazdak Farrokhzad-12/+43
r=matthewjasper lowering: extend temporary lifetimes around await Fixes #63832. r? @matthewjasper cc @nikomatsakis
2019-09-10lowering: extend temporary lifetimes around awaitDavid Wood-12/+43
This commit changes the HIR lowering around `await` so that temporary lifetimes are extended. Previously, await was lowered as: ```rust { let mut pinned = future; loop { match ::std::future::poll_with_tls_context(unsafe { <::std::pin::Pin>::new_unchecked(&mut pinned) }) { ::std::task::Poll::Ready(result) => break result, ::std::task::Poll::Pending => {} } yield (); } } ``` With this commit, await is lowered as: ```rust match future { mut pinned => loop { match ::std::future::poll_with_tls_context(unsafe { <::std::pin::Pin>::new_unchecked(&mut pinned) }) { ::std::task::Poll::Ready(result) => break result, ::std::task::Poll::Pending => {} } yield (); } } ``` However, this change has the following side-effects: - All temporaries in future will be considered to live across a yield for the purpose of auto-traits. - Borrowed temporaries in future are likely to be considered to be live across the yield for the purpose of the generator transform. Signed-off-by: David Wood <david@davidtw.co>
2019-09-08Update test stderr with results of enabling unused lintsMark Rousskov-7/+20
2019-09-06Fixed grammar/style in error messages and reblessed tests.Alexander Regueiro-12/+12
2019-09-05Rollup merge of #64038 - matthewjasper:deny-mutual-impl-trait-recursion, ↵Mazdak Farrokhzad-2/+34
r=varkor Check impl trait substs when checking for recursive types closes #64004
2019-08-31Check impl trait substs when checking for recursive typesMatthew Jasper-0/+32
This prevents mutual `async fn` recursion
2019-08-31Slightly clean up the error for recursive `async fn`Matthew Jasper-2/+2
* Make it clear that type erasure is required, not just pointer indirection. * Don't make the message specific to direct recursion.
2019-08-31Use span label instead of note for cause in E0631Esteban Küber-20/+12
2019-08-27Changing error messages and renaming tests #63127Kevin Per-1/+1
`async-await/no-args-non-move-async-closure` `generator/no-arguments-on-generators`
2019-08-27Cleanup: Consistently use `Param` instead of `Arg` #62426Kevin Per-2/+2
2019-08-21more `--bless`ing + test error annotations fixesArtem Varaksa-4/+4
2019-08-21improve diagnostics: break/continue wrong contextArtem Varaksa-4/+12
2019-08-20--bless post no async_await gates in tests.Mazdak Farrokhzad-140/+138
2019-08-20Remove async_await gates from tests.Mazdak Farrokhzad-161/+11
2019-08-19Rollup merge of #63699 - gilescope:async-move-diagnostic, r=estebankMazdak Farrokhzad-0/+31
Fix suggestion from incorrect `move async` to `async move`. PR for #61920. Happy with the test. There must be a better implementation though - possibly a MIR visitor to estabilsh a span that doesn't include the `async` keyword?
2019-08-19adjust test to be check-passNiko Matsakis-13/+4
2019-08-19distinguish object-lifetime-default elision from other elisionNiko Matsakis-0/+50
Object-lifetime-default elision is distinct from other forms of elision; it always refers to some enclosing lifetime *present in the surrounding type* (e.g., `&dyn Bar` expands to `&'a (dyn Bar + 'a)`. If there is no enclosing lifetime, then it expands to `'static`. Therefore, in an `impl Trait<Item = dyn Bar>` setting, we don't expand to create a lifetime parameter for the `dyn Bar + 'X` bound. It will just be resolved to `'static`. Annoyingly, the responsibility for this resolution is spread across multiple bits of code right now (`middle::resolve_lifetimes`, `lowering`). The lowering code knows that the default is for an object lifetime, but it doesn't know what the correct result would be. Probably this should be fixed, but what we do now is a surgical fix: we have it generate a different result for elided lifetimes in a object context, and then we can ignore those results when figuring out the lifetimes that are captured in the opaque type.
2019-08-19Fix suggestion from move async to async move.Giles Cope-0/+31
2019-08-18Auto merge of #63659 - gilescope:async-in-closure, r=Centrilbors-10/+9
Improved error message for break in async block Fixes #63391
2019-08-18Better error message for break in async blocks.Giles Cope-10/+9
2019-08-16bless you nllEduard-Mihai Burtescu-1/+1
2019-08-16Rollup merge of #63539 - Centril:2015.await, r=oli-obkMazdak Farrokhzad-0/+88
Suggest Rust 2018 on `<expr>.await` with no such field When type checking a field projection (`fn check_field`) to `<expr>.await` where `<expr>: τ` and `τ` is not a primitive type, suggest switching to Rust 2018. E.g. ``` error[E0609]: no field `await` on type `std::pin::Pin<&mut dyn std::future::Future<Output = ()>>` --> $DIR/suggest-switching-edition-on-await.rs:31:7 | LL | x.await; | ^^^^^ unknown field | = note: to `.await` a `Future`, switch to Rust 2018 = help: set `edition = "2018"` in `Cargo.toml` = note: for more on editions, read https://doc.rust-lang.org/edition-guide ``` Fixes https://github.com/rust-lang/rust/issues/63533 This PR also performs some preparatory cleanups in `fn check_field`; the last 2 commits are where the suggestion is introduced and tested respectively. r? @varkor
2019-08-14Rollup merge of #63509 - estebank:async-span, r=CentrilMazdak Farrokhzad-0/+23
Point at the right enclosing scope when using `await` in non-async fn Fix #63398.
2019-08-14Rollup merge of #63501 - nikomatsakis:issue-63500-async-anon-impl-lifetime, ↵Mazdak Farrokhzad-0/+34
r=cramertj use `ParamName` to track in-scope lifetimes instead of Ident Also, clear in-scope lifetimes when visiting nested items. Fixes #63500. Fixes #63225. Fixes #52532. r? @cramertj
2019-08-14Rollup merge of #63499 - ↵Mazdak Farrokhzad-0/+147
nikomatsakis:issuee-63388-async-fn-elision-self-mut-self, r=cramertj handle elision in async fn correctly We now always make fresh lifetimne parameters for all elided lifetimes, whether they are in the inputs or outputs. But then we generate `'_` in the case of elided lifetimes from the outputs. Example: ```rust async fn foo<'a>(x: &'a u32) -> &u32 { .. } ``` becomes ```rust type Foo<'a, 'b> = impl Future<Output = &'b u32>; fn foo<'a>(x: &'a u32) -> Foo<'a, '_> ``` Fixes #63388
2019-08-14typeck: add tests for suggesting -> 2018 on wrong <expr>.awaitMazdak Farrokhzad-0/+88
2019-08-13review comment: move testEsteban Küber-0/+23
2019-08-13bless tests with compare-mode=nllNiko Matsakis-0/+35
2019-08-12clear in-scope lifetimes for nested items in HIR loweringNiko Matsakis-0/+17
This was causing us to incorrectly think the lifetimes were already declared on the scope for the nested item, when in fact they are not inherited.
2019-08-12add edition to regression testNiko Matsakis-0/+1
2019-08-12revamp how we handle elision in async fnNiko Matsakis-0/+112
We now always make fresh lifetimne parameters for all elided lifetimes, whether they are in the inputs or outputs. But then we generate `'_` in the case of elided lifetimes from the outputs. Example: ```rust async fn foo<'a>(x: &'a u32) -> &u32 { .. } ``` becomes ```rust type Foo<'a, 'b> = impl Future<Output = &'b u32>; fn foo<'a>(x: &'a u32) -> Foo<'a, '_> ```
2019-08-12use `ParamName` to track in-scope lifetimes instead of IdentNiko Matsakis-0/+16
This allows us to record "fresh" lifetime names for cases like `impl Foo<'_>`.
2019-08-12typeck: Prohibit RPIT types that inherit lifetimesDavid Wood-0/+36
This commit prohibits return position `impl Trait` types that "inherit lifetimes" from the parent scope. The intent is to forbid cases that are challenging until they can be addressed properly.
2019-08-09fix testsEsteban Küber-3/+3
2019-08-09Rollup merge of #63387 - Centril:async-block-control-flow-tests, r=cramertjMazdak Farrokhzad-0/+146
Test interaction between `async { ... }` and `?`, `return`, and `break` Per the second checkbox in https://github.com/rust-lang/rust/issues/62121#issuecomment-506884048, test that `async { .. }` blocks: 1. do not allow `break` expressions. 2. get targeted by `return` and not the parent function. 3. get targeted by `?` and not the parent function. Works towards resolving blockers in #63209. r? @cramertj
2019-08-09Test interaction btw async blocks and ?, return, break.Mazdak Farrokhzad-0/+146
2019-08-08Rollup merge of #63331 - gorup:conditionalinit, r=cramertjMazdak Farrokhzad-0/+43
Test conditional initialization validation in async fns r? @cramertj Per [paper doc](https://paper.dropbox.com/doc/async.await-Call-for-Tests--AiWF2Nt8tgDiA70qFI~oiLOOAg-nMyZGrra7dz9KcFRMLKJy) calling for async/.await tests, tests are desired for conditionally initialized local variables. This PR hopes to provide tests for that. #63294 seems to be tracking the items from the paper doc that this PR is related to #62121 is an open issue asking for more async/.await tests that this relates to --- :+1: executed 2 new tests :+1: tidy
2019-08-06Test conditional initialization validation in async fnsRyan Gorup-0/+43