Skip to content

Commit 196a429

Browse files
committed
Use the general type API instead of directly accessing register_hidden_type
1 parent 14caf73 commit 196a429

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

compiler/rustc_borrowck/src/region_infer/opaque_types.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,13 +263,11 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
263263

264264
// Require that the hidden type actually fulfills all the bounds of the opaque type, even without
265265
// the bounds that the function supplies.
266-
match infcx.register_hidden_type(
267-
OpaqueTypeKey { def_id, substs: id_substs },
268-
ObligationCause::misc(instantiated_ty.span, body_id),
269-
param_env,
270-
definition_ty,
271-
origin,
272-
) {
266+
let opaque_ty = self.tcx.mk_opaque(def_id.to_def_id(), id_substs);
267+
match infcx
268+
.at(&ObligationCause::misc(instantiated_ty.span, body_id), param_env)
269+
.eq(opaque_ty, definition_ty)
270+
{
273271
Ok(infer_ok) => {
274272
for obligation in infer_ok.obligations {
275273
fulfillment_cx.register_predicate_obligation(&infcx, obligation);
@@ -280,7 +278,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
280278
.err_ctxt()
281279
.report_mismatched_types(
282280
&ObligationCause::misc(instantiated_ty.span, body_id),
283-
self.tcx.mk_opaque(def_id.to_def_id(), id_substs),
281+
opaque_ty,
284282
definition_ty,
285283
err,
286284
)

0 commit comments

Comments
 (0)