fix rustdoc wrt builtin impls switch
This commit is contained in:
parent
a6153e8218
commit
ee62514b16
8 changed files with 35 additions and 23 deletions
|
@ -1033,11 +1033,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
}
|
||||
|
||||
/// Iterates over the language items in the given crate.
|
||||
fn get_lang_items(self) -> impl Iterator<Item = (DefId, usize)> + 'a {
|
||||
self.root
|
||||
.lang_items
|
||||
.decode(self)
|
||||
.map(move |(def_index, index)| (self.local_def_id(def_index), index))
|
||||
fn get_lang_items(self, tcx: TyCtxt<'tcx>) -> &'tcx [(DefId, usize)] {
|
||||
tcx.arena.alloc_from_iter(
|
||||
self.root
|
||||
.lang_items
|
||||
.decode(self)
|
||||
.map(move |(def_index, index)| (self.local_def_id(def_index), index)),
|
||||
)
|
||||
}
|
||||
|
||||
/// Iterates over the diagnostic items in the given crate.
|
||||
|
@ -1343,6 +1345,13 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
|
|||
})
|
||||
}
|
||||
|
||||
fn get_all_incoherent_impls(self) -> impl Iterator<Item = DefId> + 'a {
|
||||
self.cdata
|
||||
.incoherent_impls
|
||||
.values()
|
||||
.flat_map(move |impls| impls.decode(self).map(move |idx| self.local_def_id(idx)))
|
||||
}
|
||||
|
||||
fn get_incoherent_impls(self, tcx: TyCtxt<'tcx>, simp: SimplifiedType) -> &'tcx [DefId] {
|
||||
if let Some(impls) = self.cdata.incoherent_impls.get(&simp) {
|
||||
tcx.arena.alloc_from_iter(impls.decode(self).map(|idx| self.local_def_id(idx)))
|
||||
|
|
|
@ -223,7 +223,7 @@ provide! { <'tcx> tcx, def_id, other, cdata,
|
|||
tcx.arena.alloc_slice(&result)
|
||||
}
|
||||
defined_lib_features => { cdata.get_lib_features(tcx) }
|
||||
defined_lang_items => { tcx.arena.alloc_from_iter(cdata.get_lang_items()) }
|
||||
defined_lang_items => { cdata.get_lang_items(tcx) }
|
||||
diagnostic_items => { cdata.get_diagnostic_items() }
|
||||
missing_lang_items => { cdata.get_missing_lang_items(tcx) }
|
||||
|
||||
|
@ -523,9 +523,12 @@ impl CStore {
|
|||
self.get_crate_data(cnum).get_inherent_impls()
|
||||
}
|
||||
|
||||
/// Decodes all lang items in the crate (for rustdoc).
|
||||
pub fn lang_items_untracked(&self, cnum: CrateNum) -> impl Iterator<Item = DefId> + '_ {
|
||||
self.get_crate_data(cnum).get_lang_items().map(|(def_id, _)| def_id)
|
||||
/// Decodes all incoherent inherent impls in the crate (for rustdoc).
|
||||
pub fn incoherent_impls_in_crate_untracked(
|
||||
&self,
|
||||
cnum: CrateNum,
|
||||
) -> impl Iterator<Item = DefId> + '_ {
|
||||
self.get_crate_data(cnum).get_all_incoherent_impls()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue