Skip to content

Comments

Check stalled coroutine obligations eagerly#152327

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
adwinwhite:fix-non-defining-use-ices-ready
Feb 9, 2026
Merged

Check stalled coroutine obligations eagerly#152327
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
adwinwhite:fix-non-defining-use-ices-ready

Conversation

@adwinwhite
Copy link
Contributor

@adwinwhite adwinwhite commented Feb 8, 2026

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

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Feb 8, 2026
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}`
Copy link
Contributor Author

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`
Copy link
Contributor Author

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One less duplicate error.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One less duplicate error.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@adwinwhite adwinwhite force-pushed the fix-non-defining-use-ices-ready branch from 75f0bac to 9a14380 Compare February 9, 2026 06:14
@rustbot
Copy link
Collaborator

rustbot commented Feb 9, 2026

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.

@rust-log-analyzer

This comment has been minimized.

@adwinwhite adwinwhite force-pushed the fix-non-defining-use-ices-ready branch from 9a14380 to f248395 Compare February 9, 2026 07:10
Copy link
Contributor

@lcnr lcnr left a 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

View changes since this review

@lcnr
Copy link
Contributor

lcnr commented Feb 9, 2026

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 9, 2026

📌 Commit f248395 has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 9, 2026
@lcnr lcnr added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Feb 9, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 9, 2026
…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
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 9, 2026
…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
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 9, 2026
…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
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 9, 2026
…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
rust-bors bot pushed a commit that referenced this pull request Feb 9, 2026
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`)
rust-bors bot pushed a commit that referenced this pull request Feb 9, 2026
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`)
rust-bors bot pushed a commit that referenced this pull request Feb 9, 2026
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`)
@rust-bors rust-bors bot merged commit 1f0e215 into rust-lang:main Feb 9, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 9, 2026
rust-timer added a commit that referenced this pull request Feb 9, 2026
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
github-actions bot pushed a commit to rust-lang/rust-analyzer that referenced this pull request Feb 16, 2026
Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#152388 (`rust-analyzer` subtree update)
 - rust-lang/rust#151613 (Align `ArrayWindows` trait impls with `Windows`)
 - rust-lang/rust#152134 (Set crt_static_allow_dylibs to true for Emscripten target)
 - rust-lang/rust#152166 (cleanup some more things in `proc_macro::bridge`)
 - rust-lang/rust#152236 (compiletest: `-Zunstable-options` for json targets)
 - rust-lang/rust#152287 (Fix an ICE in the vtable iteration for a trait reference in const eval when a supertrait not implemented)
 - rust-lang/rust#142957 (std: introduce path normalize methods at top of `std::path`)
 - rust-lang/rust#145504 (Add some conversion trait impls)
 - rust-lang/rust#152131 (Port rustc_no_implicit_bounds attribute to parser.)
 - rust-lang/rust#152315 (fix: rhs_span to rhs_span_new)
 - rust-lang/rust#152327 (Check stalled coroutine obligations eagerly)
 - rust-lang/rust#152377 (Rename the query system's `JobOwner` to `ActiveJobGuard`, and include `key_hash`)
@Kobzol
Copy link
Member

Kobzol commented Feb 17, 2026

@rust-timer build c9e0d8f

For #152399.

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (c9e0d8f): comparison URL.

Overall result: ❌✅ regressions and improvements - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.2% [0.2%, 0.2%] 1
Regressions ❌
(secondary)
0.8% [0.5%, 1.2%] 9
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 2
All ❌✅ (primary) 0.2% [0.2%, 0.2%] 1

Max RSS (memory usage)

Results (primary -1.8%, secondary 1.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
8.4% [4.6%, 15.0%] 4
Improvements ✅
(primary)
-1.8% [-2.3%, -1.2%] 4
Improvements ✅
(secondary)
-2.7% [-6.5%, -1.5%] 8
All ❌✅ (primary) -1.8% [-2.3%, -1.2%] 4

Cycles

Results (primary 2.4%, secondary 3.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.4% [2.4%, 2.4%] 1
Regressions ❌
(secondary)
3.6% [2.0%, 6.6%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.4% [2.4%, 2.4%] 1

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 475.563s -> 478.567s (0.63%)
Artifact size: 397.93 MiB -> 397.93 MiB (-0.00%)

@rustbot rustbot added the perf-regression Performance regression. label Feb 17, 2026
@Kobzol
Copy link
Member

Kobzol commented Feb 17, 2026

Seems like this PR caused the largest performance regressions from #152399. That being said, they are on a single secondary benchmark, and given that this fixes compiler bugs, I think that it is fine.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Feb 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

perf-regression Performance regression. perf-regression-triaged The performance regression has been triaged. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

6 participants