Auto merge of #83465 - michaelwoerister:safe-read_raw_bytes, r=cjgillot
Allow for reading raw bytes from rustc_serialize::Decoder without unsafe code The current `read_raw_bytes` method requires using `MaybeUninit` and `unsafe`. I don't think this is necessary. Let's see if a safe interface has any performance drawbacks. This is a followup to #83273 and will make it easier to rebase #82183. r? `@cjgillot`
This commit is contained in:
commit
0ced530534
5 changed files with 48 additions and 45 deletions
|
@ -473,8 +473,8 @@ macro_rules! implement_ty_decoder {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn read_raw_bytes(&mut self, bytes: &mut [std::mem::MaybeUninit<u8>]) -> Result<(), Self::Error> {
|
||||
self.opaque.read_raw_bytes(bytes)
|
||||
fn read_raw_bytes_into(&mut self, bytes: &mut [u8]) -> Result<(), Self::Error> {
|
||||
self.opaque.read_raw_bytes_into(bytes)
|
||||
}
|
||||
|
||||
fn error(&mut self, err: &str) -> Self::Error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue