diff options
| author | Santiago Pastorino <spastorino@gmail.com> | 2023-03-13 18:21:00 -0300 |
|---|---|---|
| committer | Santiago Pastorino <spastorino@gmail.com> | 2023-03-15 12:27:16 -0300 |
| commit | 39d19ca9f22901a9460b5dcd9897bed969809fc4 (patch) | |
| tree | 2515612300d1724c43c16e9ef5bd3bbaa051bac3 | |
| parent | 39ffe9699a2b24c72bebd1c952daf31707b68106 (diff) | |
| download | rust-39d19ca9f22901a9460b5dcd9897bed969809fc4.tar.gz rust-39d19ca9f22901a9460b5dcd9897bed969809fc4.zip | |
Make impl_trait_in_trait_container consider newly generated RPITITs
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 71bd4be6650..c6db65e7437 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -2553,11 +2553,17 @@ impl<'tcx> TyCtxt<'tcx> { } pub fn impl_trait_in_trait_parent_fn(self, mut def_id: DefId) -> DefId { - while let def_kind = self.def_kind(def_id) && def_kind != DefKind::AssocFn { - debug_assert_eq!(def_kind, DefKind::ImplTraitPlaceholder); - def_id = self.parent(def_id); + match self.opt_rpitit_info(def_id) { + Some(ImplTraitInTraitData::Trait { fn_def_id, .. }) + | Some(ImplTraitInTraitData::Impl { fn_def_id, .. }) => fn_def_id, + None => { + while let def_kind = self.def_kind(def_id) && def_kind != DefKind::AssocFn { + debug_assert_eq!(def_kind, DefKind::ImplTraitPlaceholder); + def_id = self.parent(def_id); + } + def_id + } } - def_id } pub fn impl_method_has_trait_impl_trait_tys(self, def_id: DefId) -> bool { |
