Skip to content

Commit 3f8c8f5

Browse files
committed
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.
2 parents 1baf77a + b233263 commit 3f8c8f5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/rustc_metadata/src/rmeta/encoder.rs

+7
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,13 @@ impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for Symbol {
347347
}
348348
}
349349

350+
impl<'a, 'tcx> Encodable<EncodeContext<'a, 'tcx>> for [u8] {
351+
fn encode(&self, e: &mut EncodeContext<'a, 'tcx>) {
352+
Encoder::emit_usize(e, self.len());
353+
e.emit_raw_bytes(self);
354+
}
355+
}
356+
350357
impl<'a, 'tcx> TyEncoder for EncodeContext<'a, 'tcx> {
351358
const CLEAR_CROSS_CRATE: bool = true;
352359

0 commit comments

Comments
 (0)