about summary refs log tree commit diff
path: root/src/test/ui/async-await
AgeCommit message (Collapse)AuthorLines
2020-05-22add mcve for issue 72442csmoe-0/+25
2020-05-22Auto merge of #71956 - ecstatic-morse:remove-requires-storage-analysis, ↵bors-1/+1
r=tmandry Clean up logic around live locals in generator analysis Resolves #69902. Requires #71893. I've found it difficult to make changes in the logic around live locals in `generator/transform.rs`. It uses a custom dataflow analysis, `MaybeRequiresStorage`, that AFAICT computes whether a local is either initialized or borrowed. That analysis is using `before` effects, which we should try to avoid if possible because they are harder to reason about than ones only using the unprefixed effects. @pnkfelix has suggested removing "before" effects entirely to simplify the dataflow framework, which I might pursue someday. This PR replaces `MaybeRequiresStorage` with a combination of the existing `MaybeBorrowedLocals` and a new `MaybeInitializedLocals`. `MaybeInitializedLocals` is just `MaybeInitializedPlaces` with a coarser resolution: it works on whole locals instead of move paths. As a result, I was able to simplify the logic in `compute_storage_conflicts` and `locals_live_across_suspend_points`. This is not exactly equivalent to the old logic; some generators are now smaller than before. I believe this was because the old logic was too conservative, but I'm not as familiar with the constraints as the original implementers were, so I could be wrong. For example, I don't see a reason the size of the `mixed_sizes` future couldn't be 5K. It went from 7K to 6K in this PR. r? @jonas-schievink @tmandry
2020-05-20Auto merge of #71923 - csmoe:issue-70818, r=tmandrybors-0/+32
Check non-Send/Sync upvars captured by generator Closes #70818 r? @tmandry
2020-05-19Update tests with new generator sizesDylan MacKenzie-1/+1
2020-05-19Merge branch 'master' into issue-69276csmoe-6/+69
2020-05-18bless suggestion on spell outcsmoe-10/+3
2020-05-16suggest on Self return typecsmoe-12/+0
2020-05-15implement type_implments_trait querycsmoe-6/+39
2020-05-12add ui test for issue-69276csmoe-0/+20
2020-05-11bless ui testscsmoe-2/+20
2020-05-10add test case for issue-61076csmoe-0/+12
2020-05-08checking on either interior or upvarcsmoe-1/+1
2020-05-06bless issue-70818 test casecsmoe-3/+28
2020-05-05Detect errors caused by `async` block in 2015 editionEsteban Küber-18/+9
2020-05-05record upvar into GeneratorInteriorTypeCausecsmoe-2/+4
2020-05-04add testcase for issue-70818csmoe-0/+5
2020-04-30Rollup merge of #70950 - nikomatsakis:leak-check-nll-2, r=matthewjasperDylan DPC-2/+2
extend NLL checker to understand `'empty` combined with universes This PR extends the NLL region checker to understand `'empty` combined with universes. In particular, it means that the NLL region checker no longer considers `exists<R2> { forall<R1> { R1: R2 } }` to be provable. This is work towards https://github.com/rust-lang/rust/issues/59490, but we're not all the way there. One thing in particular it does not address is error messages. The modifications to the NLL region inference code turned out to be simpler than expected. The main change is to require that if `R1: R2` then `universe(R1) <= universe(R2)`. This constraint follows from the region lattice (shown below), because we assume then that `R2` is "at least" `empty(Universe(R2))`, and hence if `R1: R2` (i.e., `R1 >= R2` on the lattice) then `R1` must be in some universe that can name `'empty(Universe(R2))`, which requires that `Universe(R1) <= Universe(R2)`. ``` static ----------+-----...------+ (greatest) | | | early-bound and | | free regions | | | | | scope regions | | | | | empty(root) placeholder(U1) | | / | | / placeholder(Un) empty(U1) -- / | / ... / | / empty(Un) -------- (smallest) ``` I also made what turned out to be a somewhat unrelated change to add a special region to represent `'empty(U0)`, which we use (somewhat hackily) to indicate well-formedness checks in some parts of the compiler. This fixes #68550. I did some investigation into fixing the error message situation. That's a bit trickier: the existing "nice region error" code around placeholders relies on having better error tracing than NLL currently provides, so that it knows (e.g.) that the constraint arose from applying a trait impl and things like that. I feel like I was hoping *not* to do such fine-grained tracing in NLL, and it seems like we...largely...got away with that. I'm not sure yet if we'll have to add more tracing information or if there is some sort of alternative. It's worth pointing out though that I've not kind of shifted my opinion on whose job it should be to enforce lifetimes: I tend to think we ought to be moving back towards *something like* the leak-check (just not the one we *had*). If we took that approach, it would actually resolve this aspect of the error message problem, because we would be resolving 'higher-ranked errors' in the trait solver itself, and hence we wouldn't have to thread as much causal information back to the region checker. I think it would also help us with removing the leak check while not breaking some of the existing crates out there. Regardless, I think it's worth landing this change, because it was relatively simple and it aligns the set of programs that NLL accepts with those that are accepted by the main region checker, and hence should at least *help* us in migration (though I guess we still also have to resolve the existing crates that rely on leak check for coherence). r? @matthewjasper
2020-04-28Rollup merge of #71340 - Valloric:more-check-pass, r=nikomatsakisDylan DPC-4/+4
Moving more build-pass tests to check-pass One or two tests became build-pass without the FIXME because they really needed build-pass (were failing without it). Helps with #62277 --- <!-- Reviewable:start --> This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/rust-lang/rust/71340) <!-- Reviewable:end -->
2020-04-28Auto merge of #71444 - RalfJung:test-async-no-opt, r=jonas-schievinkbors-0/+15
smoke-test for async fn with mir-opt-level=0 MIR opt levels heavily influence which MIR transformations run, and we barely test non-default opt levels. I am particularly worried about `async fn` lowering and how it might (not) work when the set of preceding MIR passes changes -- see https://github.com/rust-lang/rust/pull/70073. This adds some basic smoke testing, where at least a few `async fn` `run-pass` test are ensured to also work with mir-opt-level=0.
2020-04-23Moving more build-pass tests to check-passVal Markovic-4/+4
One or two tests became build-pass without the FIXME because they really needed build-pass (were failing without it). Helps with #62277
2020-04-22smoke-test for async fn with mir-opt-level=0Ralf Jung-0/+15
2020-04-22Tweak wordingEsteban Küber-1/+1
2020-04-22Tweak `'static` suggestion codeEsteban Küber-1/+5
Fix #71196.
2020-04-22Rollup merge of #71203 - csmoe:issue-71137, r=csmoeDylan DPC-0/+44
Correct await span for async-await error reporting Closes #71137 r? @tmandry
2020-04-22add test for correct await spancsmoe-0/+44
2020-04-21Rollup merge of #71174 - Nokel81:fix-async-main-error, r=petrochenkovDylan DPC-0/+43
Check that main/start is not async * Add new error code E0752 * Add span to hir::IsAsync::Yes * Emit an error if main or the start function is marked as async * Add two regression tests This PR fixes #68523.
2020-04-20Check that main/start is not asyncSebastian Malton-0/+43
* Add new error code E0752 * Add span to hir::IsAsync::Yes * Emit an error if main or the start function is marked as async * Add two regression tests Fix formatting errors and bless test outputs * move tests to ui/async-await fix test error text remove span from IsAsync
2020-04-19Do not show DefId in diagnosticsYuki Okushi-2/+24
2020-04-17Rollup merge of #71182 - JohnTitor:regression-tests, r=Mark-SimulacrumDylan DPC-0/+23
Add some regression tests Closes #24843 Closes #28575 Closes #54067 Closes #66868 Closes #67893 Closes #68813
2020-04-16Rollup merge of #70611 - pawanbisht62:doc/61137-add-long-error-code-e0708, ↵Dylan DPC-0/+1
r=GuillaumeGomez Add long error explanation for E0708 #61137 Add long explanation for the E0708 error code Part of #61137 r? @GuillaumeGomez
2020-04-17Avoid emitting stderr for nowYuki Okushi-24/+2
2020-04-17Add test for issue-67893Yuki Okushi-0/+45
2020-04-16reserve variable for empty root regionNiko Matsakis-2/+2
2020-04-16Auto merge of #70831 - sfackler:shrink-future-stack, r=matthewjasperbors-8/+2
Remove a stack frame from .await calls The stack frames when `.await`ing one async fn from another currently look like this: ``` 12: foo::b::{{closure}} at src/main.rs:2 13: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll at /home/sfackler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs:66 14: core::future::poll_with_context at /home/sfackler/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/src/libcore/future/mod.rs:84 15: foo::a::{{closure}} at src/main.rs:6 ``` Since the move away from using TLS to pass the Context around, it's now easy to remove frame 14 by removing poll_with_context in favor of calling Future::poll directly. This still leaves the `GenFuture` frame, but that seems significantly harder to deal with. It also improves diagnostics a bit since they no longer talk about the private poll_with_context function.
2020-04-13Update test after rebaseTyler Mandry-3/+3
2020-04-13Incorporate feedback into diagnosticsTyler Mandry-19/+19
2020-04-13Don't double-annotate the same SpanTyler Mandry-6/+31
2020-04-13Use clearer message when obligation is caused by await exprTyler Mandry-6/+3
2020-04-13Don't annotate type when type is opaqueTyler Mandry-3/+3
2020-04-13Improve span labelTyler Mandry-4/+4
2020-04-13Add test for #68112 (existing output)Tyler Mandry-0/+98
2020-04-12Add long error explanation for E0708 #61137bishtpawan-0/+1
Refactor code as per the suggestions Refacotor code provide edition support
2020-04-11rustc: Add a warning count upon completionRoccoDev-0/+2
2020-04-10Rollup merge of #69745 - estebank:predicate-obligations-3, r=nikomatsakis,eddybMazdak Farrokhzad-9/+9
Use `PredicateObligation`s instead of `Predicate`s Keep more information about trait binding failures. Use more specific spans by pointing at bindings that introduce obligations. Subset of #69709. r? @eddyb
2020-04-09Rollup merge of #70367 - nikomatsakis:issue-69307, r=Aaron1011Mazdak Farrokhzad-0/+53
save/restore `pessimistic_yield` when entering bodies This flag is used to make the execution order around `+=` operators pessimistic. Failure to save/restore the flag was causing independent async blocks to effect one another, leading to strange ICEs and failed assumptions. Fixes #69307 r? @Zoxc
2020-04-08Small tweaks to required bound spanEsteban Küber-9/+9
2020-04-08Suggest move for closures and async blocks in more cases.Alex Aktsipetrov-11/+42
2020-04-06add nested regression testNiko Matsakis-0/+30
2020-04-05Remove a stack frame from .await callsSteven Fackler-8/+2
2020-04-03Rollup merge of #70640 - jonas-schievink:async-ice, r=cramertjMazdak Farrokhzad-0/+56
Hide `task_context` when lowering body Fixes https://github.com/rust-lang/rust/issues/70594