Skip to content

Commit c392832

Browse files
authored
Rollup merge of #59690 - xfix:patch-17, r=cramertj
Mark unix::ffi::OsStrExt methods as inline This is a small change, but I found it surprising it's not inlined looking at the assembly.
2 parents 2e7be1e + a37c33b commit c392832

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/libstd/ffi/os_str.rs

+1
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,7 @@ impl IntoInner<Buf> for OsString {
960960
}
961961

962962
impl AsInner<Slice> for OsStr {
963+
#[inline]
963964
fn as_inner(&self) -> &Slice {
964965
&self.inner
965966
}

src/libstd/sys_common/os_str_bytes.rs

+2
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,11 @@ pub trait OsStrExt {
236236

237237
#[stable(feature = "rust1", since = "1.0.0")]
238238
impl OsStrExt for OsStr {
239+
#[inline]
239240
fn from_bytes(slice: &[u8]) -> &OsStr {
240241
unsafe { mem::transmute(slice) }
241242
}
243+
#[inline]
242244
fn as_bytes(&self) -> &[u8] {
243245
&self.as_inner().inner
244246
}

0 commit comments

Comments
 (0)