Add a specialization for encoding byte arrays in rmeta

This commit is contained in:
Ben Kimock 2023-08-27 16:33:33 -04:00
parent 734a0d0aa0
commit b233263309

View File

@ -347,6 +347,13 @@ fn encode(&self, s: &mut EncodeContext<'a, 'tcx>) {
} }
} }
impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for [u8] {
fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) {
Encoder::emit_usize(e, self.len());
e.emit_raw_bytes(self);
}
}
impl<'a, 'tcx> TyEncoder for EncodeContext<'a, 'tcx> { impl<'a, 'tcx> TyEncoder for EncodeContext<'a, 'tcx> {
const CLEAR_CROSS_CRATE: bool = true; const CLEAR_CROSS_CRATE: bool = true;