Skip to content

fix: Fix inference of AsyncFnX return type #19872

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

Merged
merged 1 commit into from
May 28, 2025

Conversation

ChayimFriedman2
Copy link
Contributor

@ChayimFriedman2 ChayimFriedman2 commented May 27, 2025

Fixes #19845.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 27, 2025
Comment on lines +437 to +439
let TyKind::Tuple(_, input_tys) = arg_param_ty.kind(Interner) else {
return None;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

dumb question: under what circumstances would we not get a TyKind::Tuple here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know but I can guess it can happen if users are messing with the raw fn_traits unstable feature. This was in extract_sig_from_projection() so I duplicated it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I could panic here, but generally in r-a we avoid panicking except in extreme cases (defensive coding and not offensive coding), because you don't know where the bugs lurk, and IDE crashing is way worse than some incorrect inference.

@Veykril Veykril added this pull request to the merge queue May 28, 2025
Merged via the queue into rust-lang:master with commit 26f4af0 May 28, 2025
14 checks passed
@ChayimFriedman2 ChayimFriedman2 deleted the async-fn-output branch May 29, 2025 00:16
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.

Incorrect return type inferrence for AsyncFn return types
4 participants