1
Fork 0

Also use the RPIT back compat hack in trait projection

This commit is contained in:
Oli Scherer 2022-02-23 13:34:39 +00:00
parent dc35d584a9
commit 360edd611d
4 changed files with 29 additions and 43 deletions

View file

@ -39,15 +39,20 @@ pub struct OpaqueTypeDecl<'tcx> {
}
impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
pub fn replace_opaque_types_with_inference_vars(
/// 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>>(
&self,
ty: Ty<'tcx>,
value: T,
body_id: HirId,
span: Span,
param_env: ty::ParamEnv<'tcx>,
) -> InferOk<'tcx, Ty<'tcx>> {
) -> InferOk<'tcx, T> {
if !value.has_opaque_types() {
return InferOk { value, obligations: vec![] };
}
let mut obligations = vec![];
let value = ty.fold_with(&mut ty::fold::BottomUpFolder {
let value = value.fold_with(&mut ty::fold::BottomUpFolder {
tcx: self.tcx,
lt_op: |lt| lt,
ct_op: |ct| ct,