Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a710e1f
account for `c_enum_min_bits` in `multiple-reprs` UI test
japaric Jan 20, 2025
b691e9f
Correct comment for FreeBSD and DragonFly BSD in unix/thread
no1wudi Jan 25, 2025
8c24c0a
Remove the common prelude module
ehuss Feb 11, 2025
51b105d
ignore vendor directory in `git status`
jyn514 Feb 13, 2025
1a3efd2
Use `slice::fill` in `io::Repeat` implementation
DaniPopes Feb 13, 2025
2f27236
alloc boxed: docs: use MaybeUninit::write instead of as_mut_ptr
jedbrown Feb 13, 2025
fb3a363
Emit MIR for each bit with on `dont_reset_cast_kind_without_updating_…
pvdrz Feb 14, 2025
46c7236
Move drop elaboration infrastructure.
nnethercote Feb 14, 2025
28b75a3
Move `MirPatch` from `rustc_middle` to `rustc_mir_transform`.
nnethercote Feb 14, 2025
b480a92
Use underline suggestions for purely 'additive' replacements
compiler-errors Feb 13, 2025
f6406df
Consider add-prefix replacements too
compiler-errors Feb 13, 2025
6d71251
Trim suggestion parts to the subset that is purely additive
compiler-errors Feb 13, 2025
4b13dfd
Rollup merge of #135778 - ferrocene:ja-gh135777, r=workingjubilee
matthiaskrgr Feb 14, 2025
678ff2a
Rollup merge of #136052 - no1wudi:fix, r=workingjubilee
matthiaskrgr Feb 14, 2025
c21a76f
Rollup merge of #136886 - ehuss:remove-prelude-common, r=jhpratt
matthiaskrgr Feb 14, 2025
2980f75
Rollup merge of #136956 - jyn514:ignore-vendor, r=Noratrieb
matthiaskrgr Feb 14, 2025
49fb61c
Rollup merge of #136958 - compiler-errors:additive-replacmeent, r=est…
matthiaskrgr Feb 14, 2025
b5fce2a
Rollup merge of #136967 - DaniPopes:io-repeat-fill, r=joboet
matthiaskrgr Feb 14, 2025
145e35a
Rollup merge of #136976 - jedbrown:jed/doc-boxed-deferred-init, r=tgr…
matthiaskrgr Feb 14, 2025
8bf77a4
Rollup merge of #137007 - pvdrz:fix-aarch64-alloc-layout, r=compiler-…
matthiaskrgr Feb 14, 2025
bd094fb
Rollup merge of #137008 - nnethercote:mv-code-into-rustc_mir_transfor…
matthiaskrgr Feb 14, 2025
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 10 additions & 18 deletions library/std/src/io/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::fmt;
use crate::io::{
self, BorrowedCursor, BufRead, IoSlice, IoSliceMut, Read, Seek, SeekFrom, SizeHint, Write,
};
use crate::mem::MaybeUninit;

/// `Empty` ignores any data written via [`Write`], and will always be empty
/// (returning zero bytes) when read via [`Read`].
Expand Down Expand Up @@ -182,35 +183,26 @@ pub const fn repeat(byte: u8) -> Repeat {
impl Read for Repeat {
#[inline]
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
for slot in &mut *buf {
*slot = self.byte;
}
buf.fill(self.byte);
Ok(buf.len())
}

#[inline]
fn read_exact(&mut self, buf: &mut [u8]) -> io::Result<()> {
for slot in &mut *buf {
*slot = self.byte;
}
buf.fill(self.byte);
Ok(())
}

#[inline]
fn read_buf(&mut self, mut buf: BorrowedCursor<'_>) -> io::Result<()> {
// SAFETY: No uninit bytes are being written
for slot in unsafe { buf.as_mut() } {
slot.write(self.byte);
}

let remaining = buf.capacity();

// SAFETY: the entire unfilled portion of buf has been initialized
unsafe {
buf.advance_unchecked(remaining);
}

// SAFETY: No uninit bytes are being written.
MaybeUninit::fill(unsafe { buf.as_mut() }, self.byte);
// SAFETY: the entire unfilled portion of buf has been initialized.
unsafe { buf.advance_unchecked(buf.capacity()) };
Ok(())
}

#[inline]
fn read_buf_exact(&mut self, buf: BorrowedCursor<'_>) -> io::Result<()> {
self.read_buf(buf)
}
Expand Down
1 change: 1 addition & 0 deletions library/std/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
#![feature(link_cfg)]
#![feature(linkage)]
#![feature(macro_metavar_expr_concat)]
#![feature(maybe_uninit_fill)]
#![feature(min_specialization)]
#![feature(must_not_suspend)]
#![feature(needs_panic_runtime)]
Expand Down