1
Fork 0

Unconditionally encode hidden types in typeck results

This commit is contained in:
Oli Scherer 2022-09-20 08:56:04 +00:00
parent 43c22af267
commit 5d15beb591
4 changed files with 43 additions and 47 deletions

View file

@ -788,20 +788,15 @@ fn find_opaque_ty_constraints_for_rpit(
// the `concrete_opaque_types` table.
tcx.ty_error()
} else {
table
.concrete_opaque_types
.get(&def_id)
.copied()
.unwrap_or_else(|| {
// We failed to resolve the opaque type or it
// resolves to itself. We interpret this as the
// no values of the hidden type ever being constructed,
// so we can just make the hidden type be `!`.
// For backwards compatibility reasons, we fall back to
// `()` until we the diverging default is changed.
Some(tcx.mk_diverging_default())
})
.expect("RPIT always have a hidden type from typeck")
table.concrete_opaque_types.get(&def_id).copied().unwrap_or_else(|| {
// We failed to resolve the opaque type or it
// resolves to itself. We interpret this as the
// no values of the hidden type ever being constructed,
// so we can just make the hidden type be `!`.
// For backwards compatibility reasons, we fall back to
// `()` until we the diverging default is changed.
tcx.mk_diverging_default()
})
}
})
}