Skip to content

fixed Implement opaques_with_sub_unified_hidden_type for the next-sol… - #23061

Open
solodevstack wants to merge 1 commit into
rust-lang:masterfrom
solodevstack:first-os
Open

fixed Implement opaques_with_sub_unified_hidden_type for the next-sol…#23061
solodevstack wants to merge 1 commit into
rust-lang:masterfrom
solodevstack:first-os

Conversation

@solodevstack

@solodevstack solodevstack commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

The following previously produced by a type mismatch "unknown" or E0599 diagnostic:

async fn test() -> ! {
Box::pin(test()).await;
}
This is a self-recursive async function returning !, while type checking its own body, .await need <Box<Pin<...>> as IntoFuture>::Output to normalize !, but that ! comes from this very function's own opaque return type.
which isn't resolved yet since we're still in the middle of checking it.
The inference variable created for the .await result ends up subunified with the unknown hidden type of the in-flight opaque, and the solver had no way to look through that relationship to the opaque's bounds.

This was fixed by implementing InferCtxt::opaques_with_sub_unified_hidden_type, which was previously stubbed to always return vec![].

That method lets the solver ask "is there an in-flight opaque type whose (still-unresolved) hidden type is sub-unified with this stuck inference variable?" and if so, fall back to that opaque's item bounds/blanket impls to keep making progress instead of giving up.

AI was used for assist but i fixed and diagnosed solution myself.

Fixes: rust-lang/rust-analyzer #22853

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants