-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
Check stalled coroutine obligations eagerly #152327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check stalled coroutine obligations eagerly #152327
Conversation
| LL | let foo: T = async { a }; | ||
| | ^ has type `False` which does not implement `Valid` | ||
|
|
||
| error[E0271]: type mismatch resolving `impl Future + Send == {async block@$DIR/stalled-coroutine-obligations.rs:40:9: 40:19}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The diagnostics for #151323 code is bad because find_best_leaf_obligation doesn't really find the leaf obligation that failed.
BestObligation proof tree visitor is kinda complicated to understand. I plan to improve the diagnostics in a follow-up PR.
| @@ -36,7 +36,6 @@ fn main() { | |||
| // one inside `g` and one inside `h`. | |||
| // Proceed and drop `t` in `g`. | |||
| Pin::new(&mut g).resume(()); | |||
| //~^ ERROR borrow of moved value: `g` | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we check stalled_coroutine_obligations before actual borrowck, we won't have borrowck diagnostics if those obligations fail.
I hope this is okay since HIR typeck failure also causes us skipping borrowck.
And stalled_coroutine_obligations should belong to HIR typeck if not for query cycle issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One less duplicate error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One less duplicate error.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
75f0bac to
9a14380
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
This comment has been minimized.
This comment has been minimized.
9a14380 to
f248395
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
smart, query check_coroutine_obligations only depends on query mir_built, so we don't have to do any delay_span_bug stuff here, we can just eagerly check them
|
@bors r+ rollup |
…es-ready, r=lcnr Check stalled coroutine obligations eagerly Fixes rust-lang#151322 Fixes rust-lang#151323 Fixes rust-lang#137916 Fixes rust-lang#138274 The problem is that stalled coroutine obligations can't be satisifed so that they cause normalization to fail in `mir_borrowck`. Thus, we failed to register any opaque to storage in the next solver. I fix it by checking these obligations earlier in `mir_borrowck`. r? @lcnr
…es-ready, r=lcnr Check stalled coroutine obligations eagerly Fixes rust-lang#151322 Fixes rust-lang#151323 Fixes rust-lang#137916 Fixes rust-lang#138274 The problem is that stalled coroutine obligations can't be satisifed so that they cause normalization to fail in `mir_borrowck`. Thus, we failed to register any opaque to storage in the next solver. I fix it by checking these obligations earlier in `mir_borrowck`. r? @lcnr
…es-ready, r=lcnr Check stalled coroutine obligations eagerly Fixes rust-lang#151322 Fixes rust-lang#151323 Fixes rust-lang#137916 Fixes rust-lang#138274 The problem is that stalled coroutine obligations can't be satisifed so that they cause normalization to fail in `mir_borrowck`. Thus, we failed to register any opaque to storage in the next solver. I fix it by checking these obligations earlier in `mir_borrowck`. r? @lcnr
…es-ready, r=lcnr Check stalled coroutine obligations eagerly Fixes rust-lang#151322 Fixes rust-lang#151323 Fixes rust-lang#137916 Fixes rust-lang#138274 The problem is that stalled coroutine obligations can't be satisifed so that they cause normalization to fail in `mir_borrowck`. Thus, we failed to register any opaque to storage in the next solver. I fix it by checking these obligations earlier in `mir_borrowck`. r? @lcnr
Rollup of 12 pull requests Successful merges: - #152388 (`rust-analyzer` subtree update) - #151613 (Align `ArrayWindows` trait impls with `Windows`) - #152134 (Set crt_static_allow_dylibs to true for Emscripten target) - #152166 (cleanup some more things in `proc_macro::bridge`) - #152236 (compiletest: `-Zunstable-options` for json targets) - #152287 (Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait not implemented) - #142957 (std: introduce path normalize methods at top of `std::path`) - #145504 (Add some conversion trait impls) - #152131 (Port rustc_no_implicit_bounds attribute to parser.) - #152315 (fix: rhs_span to rhs_span_new) - #152327 (Check stalled coroutine obligations eagerly) - #152377 (Rename the query system's `JobOwner` to `ActiveJobGuard`, and include `key_hash`)
Rollup of 12 pull requests Successful merges: - #152388 (`rust-analyzer` subtree update) - #151613 (Align `ArrayWindows` trait impls with `Windows`) - #152134 (Set crt_static_allow_dylibs to true for Emscripten target) - #152166 (cleanup some more things in `proc_macro::bridge`) - #152236 (compiletest: `-Zunstable-options` for json targets) - #152287 (Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait not implemented) - #142957 (std: introduce path normalize methods at top of `std::path`) - #145504 (Add some conversion trait impls) - #152131 (Port rustc_no_implicit_bounds attribute to parser.) - #152315 (fix: rhs_span to rhs_span_new) - #152327 (Check stalled coroutine obligations eagerly) - #152377 (Rename the query system's `JobOwner` to `ActiveJobGuard`, and include `key_hash`)
Rollup of 12 pull requests Successful merges: - #152388 (`rust-analyzer` subtree update) - #151613 (Align `ArrayWindows` trait impls with `Windows`) - #152134 (Set crt_static_allow_dylibs to true for Emscripten target) - #152166 (cleanup some more things in `proc_macro::bridge`) - #152236 (compiletest: `-Zunstable-options` for json targets) - #152287 (Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait not implemented) - #142957 (std: introduce path normalize methods at top of `std::path`) - #145504 (Add some conversion trait impls) - #152131 (Port rustc_no_implicit_bounds attribute to parser.) - #152315 (fix: rhs_span to rhs_span_new) - #152327 (Check stalled coroutine obligations eagerly) - #152377 (Rename the query system's `JobOwner` to `ActiveJobGuard`, and include `key_hash`)
Rollup merge of #152327 - adwinwhite:fix-non-defining-use-ices-ready, r=lcnr Check stalled coroutine obligations eagerly Fixes #151322 Fixes #151323 Fixes #137916 Fixes #138274 The problem is that stalled coroutine obligations can't be satisifed so that they cause normalization to fail in `mir_borrowck`. Thus, we failed to register any opaque to storage in the next solver. I fix it by checking these obligations earlier in `mir_borrowck`. r? @lcnr
Fixes #151322
Fixes #151323
Fixes #137916
Fixes #138274
The problem is that stalled coroutine obligations can't be satisifed so that they cause normalization to fail in
mir_borrowck.Thus, we failed to register any opaque to storage in the next solver.
I fix it by checking these obligations earlier in
mir_borrowck.r? @lcnr