diff options
| author | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-04-05 23:46:44 +0300 |
|---|---|---|
| committer | Vadim Petrochenkov <vadim.petrochenkov@gmail.com> | 2022-04-07 00:19:48 +0300 |
| commit | 69d6c3b2e6daa58e24ccec31961fe9d59fa332bb (patch) | |
| tree | 0b25cd96c5ed01fd187c0eab59c51186a61b04ea /compiler/rustc_metadata/src | |
| parent | c2afaba465e0bf44b9b37beba8d908b78dcdadc7 (diff) | |
| download | rust-69d6c3b2e6daa58e24ccec31961fe9d59fa332bb.tar.gz rust-69d6c3b2e6daa58e24ccec31961fe9d59fa332bb.zip | |
rustdoc: Early doc link resolution fixes and refactorings
Diffstat (limited to 'compiler/rustc_metadata/src')
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/decoder.rs | 20 | ||||
| -rw-r--r-- | compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs | 4 |
2 files changed, 15 insertions, 9 deletions
diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index 046322a42d8..3402acccf3f 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -1169,14 +1169,18 @@ impl<'a, 'tcx> CrateMetadataRef<'a> { } } - fn get_associated_item_def_ids(self, tcx: TyCtxt<'tcx>, id: DefIndex) -> &'tcx [DefId] { - if let Some(children) = self.root.tables.children.get(self, id) { - tcx.arena.alloc_from_iter( - children.decode((self, tcx.sess)).map(|child_index| self.local_def_id(child_index)), - ) - } else { - &[] - } + fn get_associated_item_def_ids( + self, + id: DefIndex, + sess: &'a Session, + ) -> impl Iterator<Item = DefId> + 'a { + self.root + .tables + .children + .get(self, id) + .unwrap_or_else(Lazy::empty) + .decode((self, sess)) + .map(move |child_index| self.local_def_id(child_index)) } fn get_associated_item(self, id: DefIndex) -> ty::AssocItem { diff --git a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs index cd3a1d72d41..63bf929fb86 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs @@ -160,7 +160,9 @@ provide! { <'tcx> tcx, def_id, other, cdata, let _ = cdata; tcx.calculate_dtor(def_id, |_,_| Ok(())) } - associated_item_def_ids => { cdata.get_associated_item_def_ids(tcx, def_id.index) } + associated_item_def_ids => { + tcx.arena.alloc_from_iter(cdata.get_associated_item_def_ids(def_id.index, tcx.sess)) + } associated_item => { cdata.get_associated_item(def_id.index) } inherent_impls => { cdata.get_inherent_implementations_for_type(tcx, def_id.index) } is_foreign_item => { cdata.is_foreign_item(def_id.index) } |
