diff options
| author | bors <bors@rust-lang.org> | 2022-08-18 15:41:30 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-08-18 15:41:30 +0000 |
| commit | 8064a495086c2e63c0ef77e8e82fe3b9b5dc535f (patch) | |
| tree | 63ebb692d20447639ee1ebb041dd75fb300d7956 /compiler/rustc_infer/src | |
| parent | bb99e6fdd99b0a9a9f75bc60b0995b4ef8e752ab (diff) | |
| parent | a85eb3d9df9f845b3ee166c8fa270efe20b4c82c (diff) | |
| download | rust-8064a495086c2e63c0ef77e8e82fe3b9b5dc535f.tar.gz rust-8064a495086c2e63c0ef77e8e82fe3b9b5dc535f.zip | |
Auto merge of #99860 - oli-obk:revert_97346, r=pnkfelix
Revert "Rollup merge of #97346 - JohnTitor:remove-back-compat-hacks, … …r=oli-obk" This reverts commit c703d11dccb4a895c7aead3b2fcd8cea8c483184, reversing changes made to 64eb9ab869bc3f9ef3645302fbf22e706eea16cf. it didn't apply cleanly, so now it works the same for RPIT and for TAIT instead of just working for RPIT, but we should keep those in sync anyway. It also exposed a TAIT bug (see the feature gated test that now ICEs). r? `@pnkfelix` fixes #99536
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, |
