about summary refs log tree commit diff
path: root/src/test/ui/async-await
AgeCommit message (Collapse)AuthorLines
2019-08-07Rollup merge of #63310 - gorup:partial-moves, r=cramertjMazdak Farrokhzad-0/+95
Tests around moving parts of structs and tuples across await points r? cramertj Per the [dropbox paper](https://paper.dropbox.com/doc/async.await-Call-for-Tests--AiR3vlp1s_Kw0yzWZ1sWMnaIAQ-nMyZGrra7dz9KcFRMLKJy) about more tests, it appears there are some tests wanted around local variables (under the section ["Dynamic semantics"](https://paper.dropbox.com/doc/async.await-Call-for-Tests--AiR3vlp1s_Kw0yzWZ1sWMnaIAg-nMyZGrra7dz9KcFRMLKJy#:uid=122335511260129643493892&h2=Dynamic-semantics)). Here is one commit, and I can probably get code up for other scenarios listed there, although I may not have the full background to know what is being targeted by the tests. Please assist me if I'm off course, thanks! --- - Executed all 4 new tests - Executed `tidy` command
2019-08-07Rollup merge of #63294 - alsuren:async-tests, r=cramertjMazdak Farrokhzad-0/+501
tests for async/await drop order This is just me helping out with https://github.com/rust-lang/rust/issues/62121 where I can. I'm also going to use this as a public place to collect my thoughts about what has already been done and what hasn't (adding comments to the dropbox paper doc was quickly getting spammy). I've tried to keep my commit messages similar to the line items on https://paper.dropbox.com/doc/async.await-Call-for-Tests--AiKouT0L41mSnK1741s~TiiRAg-nMyZGrra7dz9KcFRMLKJy as possible. A bunch of my tests are likely to be either redundant with other tests, or lower quality than other tests that people are writing. A reasonable approach might be to tell me which commits you want to keep and I'll throw away the rest of them. The part from the dropbox paper doc that I'm concentrating on here is: (items marked with `?` are ones that I can't immediately think of how to test, so I will leave for other people. Items with checkboxes are things that I have done or will try to do next) ### Dynamic semantics - `async`/`await` with unusual locals: - ? partially uninhabited - ? conditionally initialized - ~drop impls~ already done in src/test/ui/async-await/drop-order/* - ? nested drop impls - ~partially moved (e.g., `let x = (vec![], vec![]); drop(x.0); foo.await; drop(x.1);`)~ see https://github.com/rust-lang/rust/pull/63310 - Control flow: - basic - complex - [x] `.await` while holding variables of different sizes - (possibly) drop order - [x] including drop order for locals when a future is dropped part-way through execution - Parameters' drop order is covered in my commit f40190a - ~An async fn version of `dynamic-drop.rs`~ - already done by matthewjasper in https://github.com/rust-lang/rust/pull/62193/files - ? interaction with const eval, promoteds, and temporaries - [x] drop the resulting future and check that local variables and parameters are dropped in the expected order (interaction with cancellation, in other words) - also in f40190a Explanation of commits: * 0a1bdd4 is the simplest place I could think of to explicitly test `.await` while holding variables of different sizes. I'm pretty sure that this will end up being redundant with something else, so I'm happy to drop it. * f40190a is a copy-paste from `drop-order-for-async-fn-parameters.rs` with `NeverReady.await` dumped on the end of each testcase. * Normally I don't like copy-paste-based tests, but `drop-order-for-async-fn-parameters-by-ref-binding.rs` is also copy-paste, so I thought it might be okay. * [x] I'm a bit sad that this doesn't cover non-parameter locals, but I think it should be easy enough to extend in that direction, so I might have a crack at that tomorrow. * c4940e0f90 makes a bunch of local variables and moves them into either `{}` blocks or `async move {}` blocks, checking for any surprising differences. * I have tried to give the test functions descriptive names * I have not duplicated the tests for methods with/without self. * I think that all of these tests could be rewritten to be clearer if I could write down the expected drop order next to each test.
2019-08-07Rollup merge of #63034 - tmandry:reduce-generator-size-regressions, r=cramertjMazdak Farrokhzad-0/+15
Fix generator size regressions due to optimization I tested the generator optimizations in #60187 and #61922 on the Fuchsia build, and noticed that some small generators (about 8% of the async fns in our build) increased in size slightly. This is because in #60187 we split the fields into two groups, a "prefix" non-overlap region and an overlap region, and lay them out separately. This can introduce unnecessary padding bytes between the two groups. In every single case in the Fuchsia build, it was due to there being only a single variant being used in the overlap region. This means that we aren't doing any overlapping, period. So it's better to combine the two regions into one and lay out all the fields at once, which is what this change does. r? @cramertj cc @eddyb @Zoxc
2019-08-06test drop order for locals when a future is dropped part-way through executionDavid Laban-0/+176
2019-08-06fixup! test drop order for parameters when a future is dropped part-way ↵David Laban-1/+1
through execution
2019-08-06Rollup merge of #63230 - tmandry:disallow-possibly-uninitialized, r=CentrilMazdak Farrokhzad-0/+65
Make use of possibly uninitialized data [E0381] a hard error This is one of the behaviors we no longer allow in NLL. Since it can lead to undefined behavior, I think it's definitely worth making it a hard error without waiting to turn off migration mode (#58781). Closes #60450. My ulterior motive here is making it impossible to leave variables partially initialized across a yield (see #60889, discussion at #63035), so tests are included for that. cc #54987 --- I'm not sure if bypassing the buffer is a good way of doing this. We could also make a `force_errors_buffer` or similar that gets recombined with all the errors as they are emitted. But this is simpler and seems fine to me. r? @Centril cc @cramertj @nikomatsakis @pnkfelix @RalfJung
2019-08-05Tests around moving parts of structs and tuples across await pointsRyan Gorup-0/+95
2019-08-05Make use of possibly uninitialized data a hard errorTyler Mandry-0/+65
This is one of the behaviors we no longer allow in NLL. Since it can lead to undefined behavior, I think it's definitely worth making it a hard error without waiting to turn off migration mode (#58781). Closes #60450. My ulterior motive here is making it impossible to leave variables partially initialized across a yield (see discussion at #63035), so tests are included for that.
2019-08-05test drop order for parameters when a future is dropped part-way through ↵David Laban-0/+307
execution
2019-08-04test .await while holding variables of different sizesDavid Laban-0/+18
2019-08-03Auto merge of #63180 - varkor:trait-alias-impl-trait, r=Centrilbors-7/+6
Change opaque type syntax from `existential type` to type alias `impl Trait` This implements a new feature gate `type_alias_impl_trait` (this is slightly different from the originally proposed feature name, but matches what has been used in discussion since), deprecating the old `existential_types` feature. The syntax for opaque types has been changed. In addition, the "existential" terminology has been replaced with "opaque", as per previous discussion and the RFC. This makes partial progress towards implementing https://github.com/rust-lang/rust/issues/63063. r? @Centril
2019-08-03Rollup merge of #63208 - tmandry:issue-62658, r=cramertjMazdak Farrokhzad-0/+29
Round generator sizes to a multiple of their alignment Fixes #62658. r? @cramertj cc @eddyb
2019-08-02Resolve FIXME with async-await testvarkor-3/+1
2019-08-02Fix fallout after rebasevarkor-230/+0
2019-08-02Replace "existential" by "opaque"varkor-2/+232
2019-08-02Update syntax in existing testsvarkor-3/+4
2019-08-01Round generator sizes to multiple of their alignmentTyler Mandry-0/+29
Fixes #62658.
2019-07-30Adjust tests. wrt. await_macro being removed.Mazdak Farrokhzad-252/+117
2019-07-29Wrap promoted generator fields in MaybeUninitTyler Mandry-0/+15
This prevents uninhabited fields from "infecting" the abi and largest_niche of the generator layout. This fixes a latent bug, where an uninhabited field could be promoted to the generator prefix and cause the entire generator to become uninhabited.
2019-07-28Better recursive async fn error message.Giles Cope-4/+4
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-18Rollup merge of #62777 - gilescope:self-referencial-to-recursion, r=eddybMark Rousskov-1/+1
Self-referencial type now called a recursive type As per Boat's suggestion - #62539, this makes the error message clearer.
2019-07-18Self-referencial type renamed to recursive type.Giles Cope-1/+1
2019-07-12test `unsafe fn` and `async unsafe fn` calls in `unsafe { async || }`Delan Azabani-2/+25
2019-07-12remove redundant async_closure test in async-await.rsDelan Azabani-7/+1
2019-07-12test E0133 when calling free/impl `async unsafe fn` in `async fn`Delan Azabani-1/+22
2019-07-12remove unused #![feature(async_closure)]Delan Azabani-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-12test `unsafe fn` and `async unsafe fn` calls in `async` in `unsafe`Delan Azabani-0/+26
2019-07-12test E0133 when calling free/impl `async unsafe fn` in safe codeDelan Azabani-0/+35
2019-07-12align async-await.rs and await-macro.rs with one anotherDelan Azabani-3/+20
2019-07-11Rollup merge of #62270 - agnxy:move-async-test, r=Centril,tmandryMazdak Farrokhzad-0/+299
Move async-await tests from run-pass to ui fix #62236 r? @Centril
2019-07-10Ignore async-fn-size-moved-locals test on wasm Andrew Xu-0/+1
The sizes for wasm are different. Co-Authored-By: Tyler Mandry <tmandry@gmail.com>
2019-07-09Auto merge of #62542 - Centril:rollup-5mpb8tu, r=Centrilbors-1/+1
Rollup of 9 pull requests Successful merges: - #62417 (Fix ICEs when `Self` is used in type aliases) - #62450 (Raise the default recursion limit to 128) - #62470 (Prevent shrinking of "crate select" element on Firefox) - #62515 (cli: make help output for -l and -L consistent) - #62520 (Regression test for issue 42574.) - #62526 (normalize use of backticks in compiler messages for libsyntax/feature_gate.rs) - #62527 (clarify that debug_assert does not completely omits the code) - #62535 (ci: Configure $CI_JOB_NAME correctly) - #62541 (Add spastorino for rustc-guide toolstate) Failed merges: r? @ghost
2019-07-09Auto merge of #62221 - jonas-schievink:normalize-impl-trait, r=nikomatsakisbors-0/+16
Normalize projections appearing in `impl Trait` Fixes #60414 This does not try to do the same for `existential type`s (which have the same bug), since that always seems to lead to cycle errors.
2019-07-09normalize use of backticks in compiler messages for libsyntax/feature_gateSamy Kacimi-1/+1
https://github.com/rust-lang/rust/issues/60532
2019-07-06Add missing aux-build directiveAndrew Xu-1/+1
2019-07-06Move the test async-fn-size-moved-locals to uiAndrew Xu-0/+100
2019-07-06Remove duplicated arc_wake.rsAndrew Xu-0/+61
The auxiliary file arc_wake.rs is in run-pass/auxiliary and also ui/async-await/auxiliary. Remove the former one as their contents are same. Move run-pass/futures-api.rs to ui/async-await/futures-api.rs as it needs to use arc_wake.rs.
2019-07-06Move async-await tests from run-pass to uiAndrew Xu-0/+137
2019-07-06Fix test annotationYuki Okushi-1/+1
2019-07-05Rollup merge of #62388 - rust-lang:fix-loop-break-mir-generation, r=eddybMazdak Farrokhzad-0/+16
Break out of the correct number of scopes in loops We were incorrectly breaking out of one too many drop scopes when generating MIR for loops and breakable blocks, resulting in use after free and associated borrow checker warnings. This wasn't noticed because the scope that we're breaking out of twice is only used for temporaries that are created for adjustments applied to the loop. Since loops generally propagate coercions to the `break` expressions, the only case we see this is when the type of the loop is a smart pointer to a trait object. Closes #62312
2019-07-05Rollup merge of #62383 - Aaron1011:fix/async-error-span, r=varkorMazdak Farrokhzad-0/+32
Improve error span for async type inference error Fixes #62382 Previously, we would point at the spawn of the 'await' expression, instead of the actual expression with an unknown type.
2019-07-05Rollup merge of #62324 - Centril:reduce-await-macro-reliance, r=cramertjMazdak Farrokhzad-20/+20
Reduce reliance on `await!(...)` macro Only the last commit is new. r? @cramertj
2019-07-05Rollup merge of #62292 - Centril:split-async-closures, r=cramertjMazdak Farrokhzad-65/+205
Move `async || ...` closures into `#![feature(async_closure)]` The `async || expr` syntax is moved out from `#![feature(async_await)]` into its own gate `#![feature(async_closure)]`. New tracking issue: https://github.com/rust-lang/rust/issues/62290 Closes https://github.com/rust-lang/rust/issues/62214. cc https://github.com/rust-lang/rust/issues/62149 r? @varkor
2019-07-04Break out of the correct number of scopes in loopsMatthew Jasper-0/+16
We were incorrectly breaking out of one too many drop scopes when generating MIR for loops and breakable blocks, resulting in use after free and associated borrow checker warnings. This wasn't noticed because the scope that we're breaking out of twice is only used for temporaries that are created for adjustments applied to the loop. Since loops generally propagate coercions to the `break` expressions, the only case we see this is when the type of the loop is a smart pointer to a trait object.
2019-07-04Improve error span for async type inference errorAaron Hill-0/+32
Fixes #62382 Previously, we would point at the spawn of the 'await' expression, instead of the actual expression with an unknown type.
2019-07-04Rollup merge of #62317 - JohnTitor:move-tests-to-build-pass, r=CentrilMazdak Farrokhzad-14/+14
Migrate `compile-pass` annotations to `build-pass` This is a part of #62277. As a first step, the `compile-pass` tests are migrated to `build-pass`. r? @cramertj cc @Centril
2019-07-04Reduce reliance on feature(await_macro).Mazdak Farrokhzad-20/+20
2019-07-03Adjust tests wrt. 'async_closure' feature gate.Mazdak Farrokhzad-65/+205
2019-07-03Normalize projections in opaque typesJonas Schievink-0/+16
2019-07-03Migrate compile-pass annotations to build-passYuki Okushi-14/+14