mirror of https://github.com/rust-lang/rust.git
std: Unsafe-wrap OSStr{,ing}::from_encoded_bytes_unchecked
This commit is contained in:
parent
87d850dff0
commit
ce35265105
|
@ -160,7 +160,6 @@
|
|||
//! [`from_wide`]: crate::os::windows::ffi::OsStringExt::from_wide "os::windows::ffi::OsStringExt::from_wide"
|
||||
|
||||
#![stable(feature = "rust1", since = "1.0.0")]
|
||||
#![allow(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
#[unstable(feature = "c_str_module", issue = "112134")]
|
||||
pub mod c_str;
|
||||
|
|
|
@ -184,7 +184,7 @@ impl OsString {
|
|||
#[inline]
|
||||
#[stable(feature = "os_str_bytes", since = "1.74.0")]
|
||||
pub unsafe fn from_encoded_bytes_unchecked(bytes: Vec<u8>) -> Self {
|
||||
OsString { inner: Buf::from_encoded_bytes_unchecked(bytes) }
|
||||
OsString { inner: unsafe { Buf::from_encoded_bytes_unchecked(bytes) } }
|
||||
}
|
||||
|
||||
/// Converts to an [`OsStr`] slice.
|
||||
|
@ -813,7 +813,7 @@ impl OsStr {
|
|||
#[inline]
|
||||
#[stable(feature = "os_str_bytes", since = "1.74.0")]
|
||||
pub unsafe fn from_encoded_bytes_unchecked(bytes: &[u8]) -> &Self {
|
||||
Self::from_inner(Slice::from_encoded_bytes_unchecked(bytes))
|
||||
Self::from_inner(unsafe { Slice::from_encoded_bytes_unchecked(bytes) })
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in New Issue