Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
macro_rules! stat {
($label:literal, $f:expr) => {{
let orig_pos = self.position();
$label.encode(&mut self.opaque);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe format!("<<{}>>", $label).encode(&mut self.opaque) to make it a bit clearer that it is a label rather than just a random string?

let res = $f();
stats.push(($label, self.position() - orig_pos));
res
Expand Down
22 changes: 21 additions & 1 deletion compiler/rustc_metadata/src/rmeta/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,12 +333,32 @@ pub(crate) struct CrateDep {
pub is_private: bool,
}

#[derive(MetadataEncodable, MetadataDecodable)]
pub(crate) struct TraitImpls {
trait_id: (u32, DefIndex),
impls: LazyArray<(DefIndex, Option<SimplifiedType>)>,
}

use rustc_serialize::{Encodable, Decodable};
impl<'tcx, '__a> Encodable<EncodeContext<'__a, 'tcx>> for TraitImpls {
#[inline]
fn encode(&self, s: &mut EncodeContext<'__a, 'tcx>) {
(&b"<<TraitImpls>>"[..]).encode(s);
self.trait_id.encode(s);
self.impls.encode(s);
}
}

impl<'tcx, '__a> Decodable<DecodeContext<'__a, 'tcx>> for TraitImpls {
#[inline]
fn decode(d: &mut DecodeContext<'__a, 'tcx>) -> Self {
let _header: Vec<u8> = Decodable::decode(d);
Self {
trait_id: Decodable::decode(d),
impls: Decodable::decode(d),
}
}
}

#[derive(MetadataEncodable, MetadataDecodable)]
pub(crate) struct IncoherentImpls {
self_ty: SimplifiedType,
Expand Down
Loading