Skip to content

Rollup of 12 pull requests #138146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
93ef808
Revert vita's c_char back to i8
pheki Feb 7, 2025
7e5b1c2
Windows: Use MoveFileEx by default in `fs:rename`
ChrisDenton Feb 24, 2025
67cc82a
Inline VecDeque<u8> and BorrowedCursor methods
thaliaarchi Feb 15, 2025
41bdd2b
Override default Write methods for cursor-like types
thaliaarchi Feb 16, 2025
a8d78fe
Specialize OsString::push for strings
thaliaarchi Feb 28, 2025
83407b8
Specialize constructing OsString from strings
thaliaarchi Feb 28, 2025
b119671
Tweak BufReader::peek() doctest to expose bug in Buffer::read_more()
wgwoods Mar 1, 2025
6d07144
Fix logic error in Buffer::read_more()
wgwoods Mar 1, 2025
489e9c4
std: move stdio to `sys`
joboet Feb 9, 2025
9d8ce72
compiler: factor Windows x86-32 ABI impl into its own file
workingjubilee Feb 21, 2025
1b21952
Also add a MIR pre-codegen test for the derived `PartialOrd::le`
scottmcm Mar 2, 2025
eae5ed6
Make `is_le` and friends work like clang's
scottmcm Mar 2, 2025
3a726b1
Return OutOfMemoryError and update docs
ChrisDenton Mar 6, 2025
ab82a2c
tests: fix `issue-107495-archive-permissions` to not rely on `rustc_p…
jieyouxu Feb 24, 2025
4d77c4c
tests: fix `cross-lang-lto` to not use `path_file_prefix`
jieyouxu Feb 24, 2025
5b0b58d
run-make-support: temporarily depend on `os_pipe` and re-export it
jieyouxu Feb 24, 2025
bf88a6b
tests: fix `broken-pipe-no-ice` to not depend on unstable `anonymous_…
jieyouxu Feb 24, 2025
4e178a7
compiletest: prevent `rmake.rs` from using any nightly/unstable features
jieyouxu Feb 24, 2025
dcc4c6c
rustc-dev-guide: document `rmake.rs` may not use unstable features
jieyouxu Feb 24, 2025
ac40ea7
Suggest typo fix for static lifetime
compiler-errors Mar 6, 2025
98dc15f
stabilize const_char_classify
RalfJung Mar 6, 2025
8f8c7fc
stabilize const_sockaddr_setters
RalfJung Mar 6, 2025
2458ccd
Simplify printf and shell format suggestions
thaliaarchi Mar 1, 2025
5e3a5c6
Rollup merge of #136667 - vita-rust:revert-vita-c-char, r=cuviper
workingjubilee Mar 7, 2025
7ae8314
Rollup merge of #136780 - joboet:move_pal_stdio, r=Amanieu
workingjubilee Mar 7, 2025
3d25394
Rollup merge of #137107 - thaliaarchi:io-optional-methods/cursors, r=…
workingjubilee Mar 7, 2025
08b6d0d
Rollup merge of #137363 - workingjubilee:untangle-x86-abi-impl, r=jie…
workingjubilee Mar 7, 2025
bcb3cf3
Rollup merge of #137528 - ChrisDenton:rename-win, r=joboet
workingjubilee Mar 7, 2025
2cdca2e
Rollup merge of #137537 - jieyouxu:daily-rmake, r=Kobzol
workingjubilee Mar 7, 2025
1e74f48
Rollup merge of #137777 - thaliaarchi:os_string-push-str, r=joboet
workingjubilee Mar 7, 2025
5b5695c
Rollup merge of #137832 - wgwoods:fix-bufreader-peek, r=joboet
workingjubilee Mar 7, 2025
a727e02
Rollup merge of #137904 - scottmcm:ordering-is, r=workingjubilee
workingjubilee Mar 7, 2025
1175f71
Rollup merge of #138115 - compiler-errors:static-typo, r=BoxyUwU
workingjubilee Mar 7, 2025
421d17e
Rollup merge of #138125 - thaliaarchi:defer-alloc-printf-suggestion, …
workingjubilee Mar 7, 2025
9872133
Rollup merge of #138129 - RalfJung:stabilize-const-things, r=tgross35
workingjubilee Mar 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 48 additions & 2 deletions library/std/src/ffi/os_str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,30 @@ impl OsString {
#[inline]
#[rustc_confusables("append", "put")]
pub fn push<T: AsRef<OsStr>>(&mut self, s: T) {
self.inner.push_slice(&s.as_ref().inner)
trait SpecPushTo {
fn spec_push_to(&self, buf: &mut OsString);
}

impl<T: AsRef<OsStr>> SpecPushTo for T {
#[inline]
default fn spec_push_to(&self, buf: &mut OsString) {
buf.inner.push_slice(&self.as_ref().inner);
}
}

// Use a more efficient implementation when the string is UTF-8.
macro spec_str($T:ty) {
impl SpecPushTo for $T {
#[inline]
fn spec_push_to(&self, buf: &mut OsString) {
buf.inner.push_str(self);
}
}
}
spec_str!(str);
spec_str!(String);

s.spec_push_to(self)
}

/// Creates a new `OsString` with at least the given capacity.
Expand Down Expand Up @@ -587,7 +610,30 @@ impl<T: ?Sized + AsRef<OsStr>> From<&T> for OsString {
/// Copies any value implementing <code>[AsRef]&lt;[OsStr]&gt;</code>
/// into a newly allocated [`OsString`].
fn from(s: &T) -> OsString {
s.as_ref().to_os_string()
trait SpecToOsString {
fn spec_to_os_string(&self) -> OsString;
}

impl<T: AsRef<OsStr>> SpecToOsString for T {
#[inline]
default fn spec_to_os_string(&self) -> OsString {
self.as_ref().to_os_string()
}
}

// Preserve the known-UTF-8 property for strings.
macro spec_str($T:ty) {
impl SpecToOsString for $T {
#[inline]
fn spec_to_os_string(&self) -> OsString {
OsString::from(String::from(self))
}
}
}
spec_str!(str);
spec_str!(String);

s.spec_to_os_string()
}
}

Expand Down
5 changes: 5 additions & 0 deletions library/std/src/sys/os_str/bytes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,11 @@ impl Buf {
self.inner.extend_from_slice(&s.inner)
}

#[inline]
pub fn push_str(&mut self, s: &str) {
self.inner.extend_from_slice(s.as_bytes());
}

#[inline]
pub fn reserve(&mut self, additional: usize) {
self.inner.reserve(additional)
Expand Down
5 changes: 5 additions & 0 deletions library/std/src/sys/os_str/wtf8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ impl Buf {
self.inner.push_wtf8(&s.inner)
}

#[inline]
pub fn push_str(&mut self, s: &str) {
self.inner.push_str(s);
}

#[inline]
pub fn reserve(&mut self, additional: usize) {
self.inner.reserve(additional)
Expand Down