Skip to content

Commit

Permalink
Revert "Rollup merge of rust-lang#123979 - oli-obk:define_opaque_type…
Browse files Browse the repository at this point in the history
…s7, r=compiler-errors"

This reverts commit f939d1f, reversing
changes made to 183c706.

(cherry picked from commit 56c135c)
  • Loading branch information
oli-obk authored and cuviper committed Jun 6, 2024
1 parent b8fb165 commit 97e94c1
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -945,27 +945,14 @@ impl<'tcx> InferCtxt<'tcx> {
(&ty::Infer(ty::TyVar(a_vid)), &ty::Infer(ty::TyVar(b_vid))) => {
return Err((a_vid, b_vid));
}
// We don't silently want to constrain hidden types here, so we assert that either one side is
// an infer var, so it'll get constrained to whatever the other side is, or there are no opaque
// types involved.
// We don't expect this to actually get hit, but if it does, we now at least know how to write
// a test for it.
(_, ty::Infer(ty::TyVar(_))) => {}
(ty::Infer(ty::TyVar(_)), _) => {}
_ if r_a != r_b && (r_a, r_b).has_opaque_types() => {
span_bug!(
cause.span(),
"opaque types got hidden types registered from within subtype predicate: {r_a:?} vs {r_b:?}"
)
}
_ => {}
}

self.enter_forall(predicate, |ty::SubtypePredicate { a_is_expected, a, b }| {
if a_is_expected {
Ok(self.at(cause, param_env).sub(DefineOpaqueTypes::Yes, a, b))
Ok(self.at(cause, param_env).sub(DefineOpaqueTypes::No, a, b))
} else {
Ok(self.at(cause, param_env).sup(DefineOpaqueTypes::Yes, b, a))
Ok(self.at(cause, param_env).sup(DefineOpaqueTypes::No, b, a))
}
})
}
Expand Down

0 comments on commit 97e94c1

Please sign in to comment.