Skip to content

Commit 39d19ca

Browse files
committed
Make impl_trait_in_trait_container consider newly generated RPITITs
1 parent 39ffe96 commit 39d19ca

File tree

1 file changed

+10
-4
lines changed
  • compiler/rustc_middle/src/ty

1 file changed

+10
-4
lines changed

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2553,11 +2553,17 @@ impl<'tcx> TyCtxt<'tcx> {
25532553
}
25542554

25552555
pub fn impl_trait_in_trait_parent_fn(self, mut def_id: DefId) -> DefId {
2556-
while let def_kind = self.def_kind(def_id) && def_kind != DefKind::AssocFn {
2557-
debug_assert_eq!(def_kind, DefKind::ImplTraitPlaceholder);
2558-
def_id = self.parent(def_id);
2556+
match self.opt_rpitit_info(def_id) {
2557+
Some(ImplTraitInTraitData::Trait { fn_def_id, .. })
2558+
| Some(ImplTraitInTraitData::Impl { fn_def_id, .. }) => fn_def_id,
2559+
None => {
2560+
while let def_kind = self.def_kind(def_id) && def_kind != DefKind::AssocFn {
2561+
debug_assert_eq!(def_kind, DefKind::ImplTraitPlaceholder);
2562+
def_id = self.parent(def_id);
2563+
}
2564+
def_id
2565+
}
25592566
}
2560-
def_id
25612567
}
25622568

25632569
pub fn impl_method_has_trait_impl_trait_tys(self, def_id: DefId) -> bool {

0 commit comments

Comments
 (0)