Skip to content

Commit c6a4f81

Browse files
committed
Replace a DefiningOpaqueTypes::No with Yes by asserting that one side of the comparison is a type variable.
Thus there will never be an opaque type involved in a way that constrains its hidden type, as the other side of the comparison is always a generator witness type
1 parent c9889b0 commit c6a4f81

File tree

1 file changed

+5
-1
lines changed
  • compiler/rustc_hir_typeck/src/fn_ctxt

1 file changed

+5
-1
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -561,9 +561,13 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
561561

562562
// Unify `interior` with `witness` and collect all the resulting obligations.
563563
let span = self.tcx.hir().body(body_id).value.span;
564+
let ty::Infer(ty::InferTy::TyVar(_)) = interior.kind() else {
565+
span_bug!(span, "coroutine interior witness not infer: {:?}", interior.kind())
566+
};
564567
let ok = self
565568
.at(&self.misc(span), self.param_env)
566-
.eq(DefineOpaqueTypes::No, interior, witness)
569+
// Will never define opaque types, as all we do is instantiate a type variable.
570+
.eq(DefineOpaqueTypes::Yes, interior, witness)
567571
.expect("Failed to unify coroutine interior type");
568572
let mut obligations = ok.obligations;
569573

0 commit comments

Comments
 (0)