Skip to content

Commit 061d4e8

Browse files
committed
Apply cfg(not(no_global_oom_handling) to everything
1 parent bad7e05 commit 061d4e8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/alloc/src/slice.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1072,11 +1072,13 @@ where
10721072
}
10731073

10741074
// When dropped, copies from `src` into `dest`.
1075+
#[cfg(not(no_global_oom_handling))]
10751076
struct InsertionHole<T> {
10761077
src: *const T,
10771078
dest: *mut T,
10781079
}
10791080

1081+
#[cfg(not(no_global_oom_handling))]
10801082
impl<T> Drop for InsertionHole<T> {
10811083
fn drop(&mut self) {
10821084
unsafe {
@@ -1398,6 +1400,7 @@ impl<T: IsCopyMarker> IsCopy for T {
13981400
}
13991401

14001402
#[inline]
1403+
#[cfg(not(no_global_oom_handling))]
14011404
fn qualifies_for_branchless_sort<T>() -> bool {
14021405
// This is a heuristic, and as such it will guess wrong from time to time. The two parts broken
14031406
// down:
@@ -1416,6 +1419,7 @@ fn qualifies_for_branchless_sort<T>() -> bool {
14161419

14171420
/// Swap two values in array pointed to by a_ptr and b_ptr if b is less than a.
14181421
#[inline]
1422+
#[cfg(not(no_global_oom_handling))]
14191423
unsafe fn branchless_swap<T>(a_ptr: *mut T, b_ptr: *mut T, should_swap: bool) {
14201424
// This is a branchless version of swap if.
14211425
// The equivalent code with a branch would be:
@@ -1443,6 +1447,7 @@ unsafe fn branchless_swap<T>(a_ptr: *mut T, b_ptr: *mut T, should_swap: bool) {
14431447

14441448
/// Swap two values in array pointed to by a_ptr and b_ptr if b is less than a.
14451449
#[inline]
1450+
#[cfg(not(no_global_oom_handling))]
14461451
unsafe fn swap_if_less<T, F>(arr_ptr: *mut T, a: usize, b: usize, is_less: &mut F)
14471452
where
14481453
F: FnMut(&T, &T) -> bool,
@@ -1470,6 +1475,7 @@ where
14701475
/// Comparing and swapping anything but adjacent elements will yield a non stable sort.
14711476
/// So this must be fundamental building block for stable sorting networks.
14721477
#[inline]
1478+
#[cfg(not(no_global_oom_handling))]
14731479
unsafe fn swap_next_if_less<T, F>(arr_ptr: *mut T, is_less: &mut F)
14741480
where
14751481
F: FnMut(&T, &T) -> bool,

0 commit comments

Comments
 (0)