Skip to content

Sync function call args check fudging with rustc#22092

Merged
ShoyuVanilla merged 1 commit intorust-lang:masterfrom
ShoyuVanilla:fudge
Apr 19, 2026
Merged

Sync function call args check fudging with rustc#22092
ShoyuVanilla merged 1 commit intorust-lang:masterfrom
ShoyuVanilla:fudge

Conversation

@ShoyuVanilla
Copy link
Copy Markdown
Member

Apply changes in rust-lang/rust#149320 and rust-lang/rust#150316, which fix some inference failures on rustc

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 19, 2026
.map(|&ty| self.table.infer_ctxt.resolve_vars_if_possible(ty))
.collect(),
))
Ok(Some(formal_input_tys.clone()))
Copy link
Copy Markdown
Member Author

@ShoyuVanilla ShoyuVanilla Apr 19, 2026

Choose a reason for hiding this comment

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

This isn't (yet) applied to rustc, but as we call resolve_vars_if_possible in fudge_inference_if_ok, no need to do it again here

Ok((snapshot_vars, self.resolve_vars_if_possible(value)))

View changes since the review

Copy link
Copy Markdown
Contributor

@ChayimFriedman2 ChayimFriedman2 left a comment

Choose a reason for hiding this comment

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

Having authored these PRs, I assume you understand in this more than I do 😅

View changes since this review

.iter()
.map(|&ty| {
let generalized_ty = self.table.next_ty_var();
let _ = self.demand_eqtype(call_expr.into(), ty, generalized_ty);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is interesting, if you'd demand supertype/subtype I would understand, but isn't demand_eqtype equivalent to setting the type var?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, it's a bit subtle thing. Relating a type with a ty var generalizes it, which entails normalization:

pub fn instantiate_ty_var<R: PredicateEmittingRelation<InferCtxt<'db>>>(

ocx.sup(&origin, self.table.param_env, expected_output, formal_output)?;

for &ty in &formal_input_tys {
ocx.register_obligation(Obligation::new(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We have self.table.register_wf_obligation(), for short.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ah, I forgot about it 😅 Thanks!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh wait, I think we shouldn't use it, since we are probing in this context so we shouldn't leave anything to the table.fulfillment_cx when leaving out of the probe. That's why we are creating a fresh new let ocx = ObligationCtxt::new(..) in this scope

@ShoyuVanilla ShoyuVanilla added this pull request to the merge queue Apr 19, 2026
Merged via the queue into rust-lang:master with commit 2541da9 Apr 19, 2026
18 checks passed
@ShoyuVanilla ShoyuVanilla deleted the fudge branch April 19, 2026 14:21
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 19, 2026
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.

3 participants