diff options
| author | Lukas Markeffsky <@> | 2024-04-21 18:04:50 +0200 |
|---|---|---|
| committer | Lukas Markeffsky <@> | 2024-04-21 18:04:50 +0200 |
| commit | 5a2b335e498202e4470ccccd6cc32b0b4133738e (patch) | |
| tree | fa87dd8e4de7dc796f23de547e9eb197ac7ead1e | |
| parent | 31a05a227afb9aa2b2ad02a04593f86aea7641e4 (diff) | |
| download | rust-5a2b335e498202e4470ccccd6cc32b0b4133738e.tar.gz rust-5a2b335e498202e4470ccccd6cc32b0b4133738e.zip | |
also remap RPITITs nested in other types back to their opaques
| -rw-r--r-- | compiler/rustc_hir_analysis/src/collect/item_bounds.rs | 4 | ||||
| -rw-r--r-- | tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs index c2205815ba6..02291cc603e 100644 --- a/compiler/rustc_hir_analysis/src/collect/item_bounds.rs +++ b/compiler/rustc_hir_analysis/src/collect/item_bounds.rs @@ -4,7 +4,7 @@ use rustc_data_structures::fx::FxIndexSet; use rustc_hir as hir; use rustc_infer::traits::util; use rustc_middle::ty::GenericArgs; -use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeFolder}; +use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable}; use rustc_span::def_id::{DefId, LocalDefId}; use rustc_span::Span; @@ -214,7 +214,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTyToOpaque<'tcx> { { self.tcx.type_of(projection_ty.def_id).instantiate(self.tcx, projection_ty.args) } else { - ty + ty.super_fold_with(self) } } } diff --git a/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs b/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs index 3a173efb32d..10c2a811243 100644 --- a/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs +++ b/tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs @@ -6,6 +6,10 @@ trait Foo { fn foo() -> impl Deref<Target = impl Deref<Target = impl Sized>> { &&() } + + fn bar() -> impl Deref<Target = Option<impl Sized>> { + &Some(()) + } } fn main() {} |
