Skip to content

Commit

Permalink
Auto merge of #97701 - compiler-errors:🅱-remove-arg-matrix, r=estebank
Browse files Browse the repository at this point in the history
[beta] Revert arg matrix algorithm from `check_argument_types`

We decided in T-compiler meeting that this is best removed in beta, and reworked to be less ICE-y on nightly: https://rust-lang.zulipchat.com/#narrow/stream/238009-t-compiler.2Fmeetings/topic/.5Bweekly.5D.202022-06-02/near/284755523

r? `@jackh726` `@estebank`
  • Loading branch information
bors committed Jun 8, 2022
2 parents a5cf77c + 2f1bf16 commit 8fd9e5f
Show file tree
Hide file tree
Showing 163 changed files with 1,671 additions and 7,473 deletions.
12 changes: 5 additions & 7 deletions compiler/rustc_typeck/src/check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1416,13 +1416,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
) {
let tcx = self.tcx;

let expected_inputs =
self.expected_inputs_for_expected_output(span, expected, adt_ty, &[adt_ty]);
let adt_ty_hint = if let Some(expected_inputs) = expected_inputs {
expected_inputs.get(0).cloned().unwrap_or(adt_ty)
} else {
adt_ty
};
let adt_ty_hint = self
.expected_inputs_for_expected_output(span, expected, adt_ty, &[adt_ty])
.get(0)
.cloned()
.unwrap_or(adt_ty);
// re-link the regions that EIfEO can erase.
self.demand_eqtype(span, adt_ty_hint, adt_ty);

Expand Down
8 changes: 4 additions & 4 deletions compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,9 +755,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
expected_ret: Expectation<'tcx>,
formal_ret: Ty<'tcx>,
formal_args: &[Ty<'tcx>],
) -> Option<Vec<Ty<'tcx>>> {
) -> Vec<Ty<'tcx>> {
let formal_ret = self.resolve_vars_with_obligations(formal_ret);
let ret_ty = expected_ret.only_has_type(self)?;
let Some(ret_ty) = expected_ret.only_has_type(self) else { return vec![]; };

// HACK(oli-obk): This is a hack to keep RPIT and TAIT in sync wrt their behaviour.
// Without it, the inference
Expand All @@ -779,7 +779,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
if let ty::subst::GenericArgKind::Type(ty) = ty.unpack() {
if let ty::Opaque(def_id, _) = *ty.kind() {
if self.infcx.opaque_type_origin(def_id, DUMMY_SP).is_some() {
return None;
return vec![];
}
}
}
Expand Down Expand Up @@ -820,7 +820,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {

// Record all the argument types, with the substitutions
// produced from the above subtyping unification.
Ok(Some(formal_args.iter().map(|&ty| self.resolve_vars_if_possible(ty)).collect()))
Ok(formal_args.iter().map(|&ty| self.resolve_vars_if_possible(ty)).collect())
})
.unwrap_or_default();
debug!(?formal_args, ?formal_ret, ?expect_args, ?expected_ret);
Expand Down
Loading

0 comments on commit 8fd9e5f

Please sign in to comment.