Auto merge of #115287 - saethlin:more-specialer, r=cjgillot

Add a specialization for encoding byte arrays in rmeta

This specialization already exists for FileEncoder, but since EncodeContext is implemented by forwarding down to FileEncoder, using EncodeContext used to bypass the specialization.
This commit is contained in:
bors 2023-08-28 01:44:41 +00:00
commit 3f8c8f51f7

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> {
const CLEAR_CROSS_CRATE: bool = true;