Skip to content

Commit

Permalink
Unrolled build for rust-lang#137032
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#137032 - oli-obk:push-ptvssqnomkpo, r=the8472

Decode metadata buffer in one go

Not sure if this is perf relevant at all, but it was a bit odd before

r? ``@the8472``
  • Loading branch information
rust-timer authored Feb 15, 2025
2 parents fc147b4 + be2cd95 commit fa91148
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions compiler/rustc_metadata/src/rmeta/encoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2272,10 +2272,7 @@ impl<D: Decoder> Decodable<D> for EncodedMetadata {
let len = d.read_usize();
let mmap = if len > 0 {
let mut mmap = MmapMut::map_anon(len).unwrap();
for _ in 0..len {
(&mut mmap[..]).write_all(&[d.read_u8()]).unwrap();
}
mmap.flush().unwrap();
mmap.copy_from_slice(d.read_raw_bytes(len));
Some(mmap.make_read_only().unwrap())
} else {
None
Expand Down

0 comments on commit fa91148

Please sign in to comment.