about summary refs log tree commit diff
path: root/library/std/src/sys/unix/os_str.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-12-31 22:57:51 +0000
committerbors <bors@rust-lang.org>2021-12-31 22:57:51 +0000
commit4d2e0fd96ccbb9ade41f1a3f07b14b7437f8e4ef (patch)
treeae02e3e70631489b0ee454b28b13242f8ecdc4ea /library/std/src/sys/unix/os_str.rs
parentcfa3fe5af339e724209b25715282adae0c61628f (diff)
parent2da54c729ecd3ad6a4557ccc6b4f9e6ef8632ae2 (diff)
downloadrust-4d2e0fd96ccbb9ade41f1a3f07b14b7437f8e4ef.tar.gz
rust-4d2e0fd96ccbb9ade41f1a3f07b14b7437f8e4ef.zip
Auto merge of #92465 - matthiaskrgr:rollup-yuary84, r=matthiaskrgr
Rollup of 7 pull requests

Successful merges:

 - #90383 (Extend check for UnsafeCell in consts to cover unions)
 - #91375 (config.rs: Add support for a per-target default_linker option.)
 - #91480 (rustdoc: use smaller number of colors to distinguish items)
 - #92338 (Add try_reserve and  try_reserve_exact for OsString)
 - #92405 (Add a couple needs-asm-support headers to tests)
 - #92435 (Sync rustc_codegen_cranelift)
 - #92440 (Fix mobile toggles position)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/sys/unix/os_str.rs')
-rw-r--r--library/std/src/sys/unix/os_str.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/os_str.rs b/library/std/src/sys/unix/os_str.rs
index ae96d6b4df4..ccbc182240c 100644
--- a/library/std/src/sys/unix/os_str.rs
+++ b/library/std/src/sys/unix/os_str.rs
@@ -2,6 +2,7 @@
 //! systems: just a `Vec<u8>`/`[u8]`.
 
 use crate::borrow::Cow;
+use crate::collections::TryReserveError;
 use crate::fmt;
 use crate::fmt::Write;
 use crate::mem;
@@ -113,11 +114,21 @@ impl Buf {
     }
 
     #[inline]
+    pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError> {
+        self.inner.try_reserve(additional)
+    }
+
+    #[inline]
     pub fn reserve_exact(&mut self, additional: usize) {
         self.inner.reserve_exact(additional)
     }
 
     #[inline]
+    pub fn try_reserve_exact(&mut self, additional: usize) -> Result<(), TryReserveError> {
+        self.inner.try_reserve_exact(additional)
+    }
+
+    #[inline]
     pub fn shrink_to_fit(&mut self) {
         self.inner.shrink_to_fit()
     }