X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=compiler%2Frustc_metadata%2Fsrc%2Frmeta%2Fdecoder.rs;h=bb729807cad9a9cc56af1a1e5107d607a41e8a6e;hb=afc0030ed3cf2ddaac52b637eeb1e629f8f39800;hp=fb1c71fb8cdbedfae8aa0ae88c53301f03fed952;hpb=2fe9f763d08cf493896262da0533fd1a3c8ae3dd;p=rust.git diff --git a/compiler/rustc_metadata/src/rmeta/decoder.rs b/compiler/rustc_metadata/src/rmeta/decoder.rs index fb1c71fb8cd..bb729807cad 100644 --- a/compiler/rustc_metadata/src/rmeta/decoder.rs +++ b/compiler/rustc_metadata/src/rmeta/decoder.rs @@ -1369,10 +1369,27 @@ fn get_inherent_implementations_for_type( ) } + /// Decodes all inherent impls in the crate (for rustdoc). + fn get_inherent_impls(self) -> impl Iterator + 'a { + (0..self.root.tables.inherent_impls.size()).flat_map(move |i| { + let ty_index = DefIndex::from_usize(i); + let ty_def_id = self.local_def_id(ty_index); + self.root + .tables + .inherent_impls + .get(self, ty_index) + .unwrap_or_else(Lazy::empty) + .decode(self) + .map(move |impl_index| (ty_def_id, self.local_def_id(impl_index))) + }) + } + + /// Decodes all traits in the crate (for rustdoc and rustc diagnostics). fn get_traits(self) -> impl Iterator + 'a { self.root.traits.decode(self).map(move |index| self.local_def_id(index)) } + /// Decodes all trait impls in the crate (for rustdoc). fn get_trait_impls(self) -> impl Iterator)> + 'a { self.cdata.trait_impls.iter().flat_map(move |((trait_cnum_raw, trait_index), impls)| { let trait_def_id = DefId {