Skip to content

Commit

Permalink
Switch can_eq and can_sub to DefineOpaqueTypes::Yes
Browse files Browse the repository at this point in the history
They are mostly used in diagnostics anyway
  • Loading branch information
oli-obk committed Feb 21, 2024
1 parent e56f0d7 commit 5da0fb1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions compiler/rustc_infer/src/infer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,9 @@ impl<'tcx> InferCtxt<'tcx> {
{
let origin = &ObligationCause::dummy();
self.probe(|_| {
self.at(origin, param_env).sub(DefineOpaqueTypes::No, expected, actual).is_ok()
// We're only answering whether there could be a subtyping relation, and with
// opaque types, "there could be one", via registering a hidden type.
self.at(origin, param_env).sub(DefineOpaqueTypes::Yes, expected, actual).is_ok()
})
}

Expand All @@ -945,7 +947,9 @@ impl<'tcx> InferCtxt<'tcx> {
T: at::ToTrace<'tcx>,
{
let origin = &ObligationCause::dummy();
self.probe(|_| self.at(origin, param_env).eq(DefineOpaqueTypes::No, a, b).is_ok())
// We're only answering whether the types could be the same, and with
// opaque types, "they can be the same", via registering a hidden type.
self.probe(|_| self.at(origin, param_env).eq(DefineOpaqueTypes::Yes, a, b).is_ok())
}

#[instrument(skip(self), level = "debug")]
Expand Down

0 comments on commit 5da0fb1

Please sign in to comment.