Skip to content

Commit 8fd9e5f

Browse files
committed
Auto merge of #97701 - compiler-errors:🅱-remove-arg-matrix, r=estebank
[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`
2 parents a5cf77c + 2f1bf16 commit 8fd9e5f

File tree

163 files changed

+1671
-7473
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

163 files changed

+1671
-7473
lines changed

compiler/rustc_typeck/src/check/expr.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1416,13 +1416,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
14161416
) {
14171417
let tcx = self.tcx;
14181418

1419-
let expected_inputs =
1420-
self.expected_inputs_for_expected_output(span, expected, adt_ty, &[adt_ty]);
1421-
let adt_ty_hint = if let Some(expected_inputs) = expected_inputs {
1422-
expected_inputs.get(0).cloned().unwrap_or(adt_ty)
1423-
} else {
1424-
adt_ty
1425-
};
1419+
let adt_ty_hint = self
1420+
.expected_inputs_for_expected_output(span, expected, adt_ty, &[adt_ty])
1421+
.get(0)
1422+
.cloned()
1423+
.unwrap_or(adt_ty);
14261424
// re-link the regions that EIfEO can erase.
14271425
self.demand_eqtype(span, adt_ty_hint, adt_ty);
14281426

compiler/rustc_typeck/src/check/fn_ctxt/_impl.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -755,9 +755,9 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
755755
expected_ret: Expectation<'tcx>,
756756
formal_ret: Ty<'tcx>,
757757
formal_args: &[Ty<'tcx>],
758-
) -> Option<Vec<Ty<'tcx>>> {
758+
) -> Vec<Ty<'tcx>> {
759759
let formal_ret = self.resolve_vars_with_obligations(formal_ret);
760-
let ret_ty = expected_ret.only_has_type(self)?;
760+
let Some(ret_ty) = expected_ret.only_has_type(self) else { return vec![]; };
761761

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

821821
// Record all the argument types, with the substitutions
822822
// produced from the above subtyping unification.
823-
Ok(Some(formal_args.iter().map(|&ty| self.resolve_vars_if_possible(ty)).collect()))
823+
Ok(formal_args.iter().map(|&ty| self.resolve_vars_if_possible(ty)).collect())
824824
})
825825
.unwrap_or_default();
826826
debug!(?formal_args, ?formal_ret, ?expect_args, ?expected_ret);

0 commit comments

Comments
 (0)