Skip to content

Conversation

@ShoyuVanilla
Copy link
Member

@ShoyuVanilla ShoyuVanilla commented Nov 4, 2025

Fixes #20951

AsyncFnMut::CallRefFuture has a lifetime parameter, so its generic params has length 3(trait self + args tuple + lifetime)

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 4, 2025
@ShoyuVanilla ShoyuVanilla changed the title fix: Fix panicking while resolving callable sigs for AsyncFnXs fix: Fix panicking while resolving callable sigs for AsyncFnMut Nov 4, 2025
let trait_ref = TraitRef::new(self.interner(), fn_trait.into(), args);

let mut proj_args: SmallVec<[_; 3]> =
GenericArgs::identity_for_item(self.interner(), output_assoc_type.into())
Copy link
Contributor

Choose a reason for hiding this comment

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

You can use GenericArgs::fill_rest(), it's nicer and more efficient.

self.interner(),
output_assoc_type.into(),
args.into_iter().map(Into::into),
|idx, id, _| mk_param(self.interner(), idx, id),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is using a Param for this correct? Despite what shown in tests, it will be interpreted as a param for the calling function, which will result... weird things. An inference var should be probably? Or look at what rustc does.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, rustc's implementation is a bit different (maybe we should change ours to match with it) but using inference vars sounds correct
https://github.com/rust-lang/rust/blob/e5efc336720901420a8891dcdb67ca0a475dc03c/compiler/rustc_hir_typeck/src/method/mod.rs#L424-L429

@ChayimFriedman2 ChayimFriedman2 added this pull request to the merge queue Nov 4, 2025
Merged via the queue into rust-lang:master with commit 5ffe3f4 Nov 4, 2025
15 checks passed
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 4, 2025
@ShoyuVanilla ShoyuVanilla deleted the async-fn-sig branch November 4, 2025 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression from 0.3.2593 to 0.3.2658; out of range parameter panic (maybe next solver related)

3 participants