diff options
Diffstat (limited to 'compiler/rustc_infer/src')
| -rw-r--r-- | compiler/rustc_infer/src/infer/opaque_types.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/compiler/rustc_infer/src/infer/opaque_types.rs b/compiler/rustc_infer/src/infer/opaque_types.rs index a1c7b70bd9c..e579afbf389 100644 --- a/compiler/rustc_infer/src/infer/opaque_types.rs +++ b/compiler/rustc_infer/src/infer/opaque_types.rs @@ -40,15 +40,17 @@ 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>> { - if !ty.has_opaque_types() { - return InferOk { value: ty, obligations: vec![] }; + ) -> InferOk<'tcx, T> { + if !value.has_opaque_types() { + return InferOk { value, obligations: vec![] }; } let mut obligations = vec![]; let replace_opaque_type = |def_id: DefId| { @@ -56,7 +58,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> { .as_local() .map_or(false, |def_id| self.opaque_type_origin(def_id, span).is_some()) }; - 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, |
