Sync function call args check fudging with rustc#22092
Sync function call args check fudging with rustc#22092ShoyuVanilla merged 1 commit intorust-lang:masterfrom
Conversation
| .map(|&ty| self.table.infer_ctxt.resolve_vars_if_possible(ty)) | ||
| .collect(), | ||
| )) | ||
| Ok(Some(formal_input_tys.clone())) |
There was a problem hiding this comment.
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
| .iter() | ||
| .map(|&ty| { | ||
| let generalized_ty = self.table.next_ty_var(); | ||
| let _ = self.demand_eqtype(call_expr.into(), ty, generalized_ty); |
There was a problem hiding this comment.
This is interesting, if you'd demand supertype/subtype I would understand, but isn't demand_eqtype equivalent to setting the type var?
There was a problem hiding this comment.
Yeah, it's a bit subtle thing. Relating a type with a ty var generalizes it, which entails normalization:
| ocx.sup(&origin, self.table.param_env, expected_output, formal_output)?; | ||
|
|
||
| for &ty in &formal_input_tys { | ||
| ocx.register_obligation(Obligation::new( |
There was a problem hiding this comment.
We have self.table.register_wf_obligation(), for short.
There was a problem hiding this comment.
Ah, I forgot about it 😅 Thanks!
There was a problem hiding this comment.
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
Apply changes in rust-lang/rust#149320 and rust-lang/rust#150316, which fix some inference failures on rustc