Use the general type API instead of directly accessing register_hidden_type
This commit is contained in:
parent
14caf7396d
commit
196a429a67
@ -263,13 +263,11 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
|||||||
|
|
||||||
// Require that the hidden type actually fulfills all the bounds of the opaque type, even without
|
// Require that the hidden type actually fulfills all the bounds of the opaque type, even without
|
||||||
// the bounds that the function supplies.
|
// the bounds that the function supplies.
|
||||||
match infcx.register_hidden_type(
|
let opaque_ty = self.tcx.mk_opaque(def_id.to_def_id(), id_substs);
|
||||||
OpaqueTypeKey { def_id, substs: id_substs },
|
match infcx
|
||||||
ObligationCause::misc(instantiated_ty.span, body_id),
|
.at(&ObligationCause::misc(instantiated_ty.span, body_id), param_env)
|
||||||
param_env,
|
.eq(opaque_ty, definition_ty)
|
||||||
definition_ty,
|
{
|
||||||
origin,
|
|
||||||
) {
|
|
||||||
Ok(infer_ok) => {
|
Ok(infer_ok) => {
|
||||||
for obligation in infer_ok.obligations {
|
for obligation in infer_ok.obligations {
|
||||||
fulfillment_cx.register_predicate_obligation(&infcx, obligation);
|
fulfillment_cx.register_predicate_obligation(&infcx, obligation);
|
||||||
@ -280,7 +278,7 @@ impl<'tcx> InferCtxtExt<'tcx> for InferCtxt<'tcx> {
|
|||||||
.err_ctxt()
|
.err_ctxt()
|
||||||
.report_mismatched_types(
|
.report_mismatched_types(
|
||||||
&ObligationCause::misc(instantiated_ty.span, body_id),
|
&ObligationCause::misc(instantiated_ty.span, body_id),
|
||||||
self.tcx.mk_opaque(def_id.to_def_id(), id_substs),
|
opaque_ty,
|
||||||
definition_ty,
|
definition_ty,
|
||||||
err,
|
err,
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user