Skip to content

Commit c751bfa

Browse files
committed
Add proper cfgs
1 parent 6cf0888 commit c751bfa

File tree

5 files changed

+11
-0
lines changed

5 files changed

+11
-0
lines changed

Diff for: library/alloc/src/alloc.rs

+3
Original file line numberDiff line numberDiff line change
@@ -423,12 +423,14 @@ pub mod __alloc_error_handler {
423423
}
424424
}
425425

426+
#[cfg(not(no_global_oom_handling))]
426427
/// Specialize clones into pre-allocated, uninitialized memory.
427428
/// Used by `Box::clone` and `Rc`/`Arc::make_mut`.
428429
pub(crate) trait WriteCloneIntoRaw: Sized {
429430
unsafe fn write_clone_into_raw(&self, target: *mut Self);
430431
}
431432

433+
#[cfg(not(no_global_oom_handling))]
432434
impl<T: Clone> WriteCloneIntoRaw for T {
433435
#[inline]
434436
default unsafe fn write_clone_into_raw(&self, target: *mut Self) {
@@ -438,6 +440,7 @@ impl<T: Clone> WriteCloneIntoRaw for T {
438440
}
439441
}
440442

443+
#[cfg(not(no_global_oom_handling))]
441444
impl<T: Copy> WriteCloneIntoRaw for T {
442445
#[inline]
443446
unsafe fn write_clone_into_raw(&self, target: *mut Self) {

Diff for: library/alloc/src/collections/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ impl Display for TryReserveError {
148148

149149
/// An intermediate trait for specialization of `Extend`.
150150
#[doc(hidden)]
151+
#[cfg(not(no_global_oom_handling))]
151152
trait SpecExtend<I: IntoIterator> {
152153
/// Extends `self` with the contents of the given iterator.
153154
fn spec_extend(&mut self, iter: I);

Diff for: library/alloc/src/rc.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2023,6 +2023,7 @@ impl<T, A: Allocator> Rc<[T], A> {
20232023
}
20242024
}
20252025

2026+
#[cfg(not(no_global_oom_handling))]
20262027
/// Specialization trait used for `From<&[T]>`.
20272028
trait RcFromSlice<T> {
20282029
fn from_slice(slice: &[T]) -> Self;

Diff for: library/alloc/src/sync.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3503,6 +3503,7 @@ impl<T> FromIterator<T> for Arc<[T]> {
35033503
}
35043504
}
35053505

3506+
#[cfg(not(no_global_oom_handling))]
35063507
/// Specialization trait used for collecting into `Arc<[T]>`.
35073508
trait ToArcSlice<T>: Iterator<Item = T> + Sized {
35083509
fn to_arc_slice(self) -> Arc<[T]>;

Diff for: library/alloc/src/vec/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ use core::cmp;
5858
use core::cmp::Ordering;
5959
use core::fmt;
6060
use core::hash::{Hash, Hasher};
61+
#[cfg(not(no_global_oom_handling))]
6162
use core::iter;
6263
use core::marker::PhantomData;
6364
use core::mem::{self, ManuallyDrop, MaybeUninit, SizedTypeProperties};
@@ -101,6 +102,7 @@ mod into_iter;
101102
#[cfg(not(no_global_oom_handling))]
102103
use self::is_zero::IsZero;
103104

105+
#[cfg(not(no_global_oom_handling))]
104106
mod is_zero;
105107

106108
#[cfg(not(no_global_oom_handling))]
@@ -2599,6 +2601,7 @@ pub fn from_elem_in<T: Clone, A: Allocator>(elem: T, n: usize, alloc: A) -> Vec<
25992601
<T as SpecFromElem>::from_elem(elem, n, alloc)
26002602
}
26012603

2604+
#[cfg(not(no_global_oom_handling))]
26022605
trait ExtendFromWithinSpec {
26032606
/// # Safety
26042607
///
@@ -2607,6 +2610,7 @@ trait ExtendFromWithinSpec {
26072610
unsafe fn spec_extend_from_within(&mut self, src: Range<usize>);
26082611
}
26092612

2613+
#[cfg(not(no_global_oom_handling))]
26102614
impl<T: Clone, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
26112615
default unsafe fn spec_extend_from_within(&mut self, src: Range<usize>) {
26122616
// SAFETY:
@@ -2626,6 +2630,7 @@ impl<T: Clone, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
26262630
}
26272631
}
26282632

2633+
#[cfg(not(no_global_oom_handling))]
26292634
impl<T: Copy, A: Allocator> ExtendFromWithinSpec for Vec<T, A> {
26302635
unsafe fn spec_extend_from_within(&mut self, src: Range<usize>) {
26312636
let count = src.len();

0 commit comments

Comments
 (0)