1
Fork 0

Add proper cfgs

This commit is contained in:
r0cky 2023-11-26 14:24:38 +08:00
parent 6cf088810f
commit c751bfa015
5 changed files with 11 additions and 0 deletions

View file

@ -423,12 +423,14 @@ pub mod __alloc_error_handler {
}
}
#[cfg(not(no_global_oom_handling))]
/// Specialize clones into pre-allocated, uninitialized memory.
/// Used by `Box::clone` and `Rc`/`Arc::make_mut`.
pub(crate) trait WriteCloneIntoRaw: Sized {
unsafe fn write_clone_into_raw(&self, target: *mut Self);
}
#[cfg(not(no_global_oom_handling))]
impl<T: Clone> WriteCloneIntoRaw for T {
#[inline]
default unsafe fn write_clone_into_raw(&self, target: *mut Self) {
@ -438,6 +440,7 @@ impl<T: Clone> WriteCloneIntoRaw for T {
}
}
#[cfg(not(no_global_oom_handling))]
impl<T: Copy> WriteCloneIntoRaw for T {
#[inline]
unsafe fn write_clone_into_raw(&self, target: *mut Self) {