Skip to content

Commit 5a2b335

Browse files
author
Lukas Markeffsky
committed
also remap RPITITs nested in other types back to their opaques
1 parent 31a05a2 commit 5a2b335

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

compiler/rustc_hir_analysis/src/collect/item_bounds.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use rustc_data_structures::fx::FxIndexSet;
44
use rustc_hir as hir;
55
use rustc_infer::traits::util;
66
use rustc_middle::ty::GenericArgs;
7-
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeFolder};
7+
use rustc_middle::ty::{self, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable};
88
use rustc_span::def_id::{DefId, LocalDefId};
99
use rustc_span::Span;
1010

@@ -214,7 +214,7 @@ impl<'tcx> TypeFolder<TyCtxt<'tcx>> for AssocTyToOpaque<'tcx> {
214214
{
215215
self.tcx.type_of(projection_ty.def_id).instantiate(self.tcx, projection_ty.args)
216216
} else {
217-
ty
217+
ty.super_fold_with(self)
218218
}
219219
}
220220
}

tests/ui/impl-trait/in-trait/nested-rpitit-bounds.rs

+4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ trait Foo {
66
fn foo() -> impl Deref<Target = impl Deref<Target = impl Sized>> {
77
&&()
88
}
9+
10+
fn bar() -> impl Deref<Target = Option<impl Sized>> {
11+
&Some(())
12+
}
913
}
1014

1115
fn main() {}

0 commit comments

Comments
 (0)