1
Fork 0

Remove a back-compat hack on lazy TAIT

This commit is contained in:
Yuki Okushi 2022-05-24 17:55:13 +09:00
parent bd2e51a338
commit c24f06354a
No known key found for this signature in database
GPG key ID: 379CEEFDD63E5DD7
4 changed files with 28 additions and 31 deletions

View file

@ -39,21 +39,19 @@ pub struct OpaqueTypeDecl<'tcx> {
}
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
/// This is a backwards compatibility hack to prevent breaking changes from
/// lazy TAIT around RPIT handling.
pub fn replace_opaque_types_with_inference_vars<T: TypeFoldable<'tcx>>(
pub fn replace_opaque_types_with_inference_vars(
&self,
value: T,
ty: Ty<'tcx>,
body_id: HirId,
span: Span,
code: ObligationCauseCode<'tcx>,
param_env: ty::ParamEnv<'tcx>,
) -> InferOk<'tcx, T> {
if !value.has_opaque_types() {
return InferOk { value, obligations: vec![] };
) -> InferOk<'tcx, Ty<'tcx>> {
if !ty.has_opaque_types() {
return InferOk { value: ty, obligations: vec![] };
}
let mut obligations = vec![];
let value = value.fold_with(&mut ty::fold::BottomUpFolder {
let value = ty.fold_with(&mut ty::fold::BottomUpFolder {
tcx: self.tcx,
lt_op: |lt| lt,
ct_op: |ct| ct,