impl CloneToUninit for Path and OsStr
This commit is contained in:
@@ -70,6 +70,8 @@
|
||||
#[cfg(test)]
|
||||
mod tests;
|
||||
|
||||
use core::clone::CloneToUninit;
|
||||
|
||||
use crate::borrow::{Borrow, Cow};
|
||||
use crate::collections::TryReserveError;
|
||||
use crate::error::Error;
|
||||
@@ -3109,6 +3111,15 @@ impl Path {
|
||||
}
|
||||
}
|
||||
|
||||
#[unstable(feature = "clone_to_uninit", issue = "126799")]
|
||||
unsafe impl CloneToUninit for Path {
|
||||
#[cfg_attr(debug_assertions, track_caller)]
|
||||
unsafe fn clone_to_uninit(&self, dst: *mut Self) {
|
||||
// SAFETY: Path is just a wrapper around OsStr
|
||||
unsafe { self.inner.clone_to_uninit(core::ptr::addr_of_mut!((*dst).inner)) }
|
||||
}
|
||||
}
|
||||
|
||||
#[stable(feature = "rust1", since = "1.0.0")]
|
||||
impl AsRef<OsStr> for Path {
|
||||
#[inline]
|
||||
|
||||
Reference in New Issue
Block a user