Skip to content

Commit 328306a

Browse files
authored
Rollup merge of rust-lang#89036 - nbdd0121:alloc, r=yaahc
Fix missing `no_global_oom_handling` cfg-gating Cfg-gate these trait impls that are neglected. These functions compile now because they use `box` syntax which depends on `exchange_malloc` during codegen only; as a result they compiles with cfg `no_global_oom_handling` but shouldn't. Discovered in rust-lang#89030 because that PR makes `box` syntax depend on `exchange_malloc` lang item during MIR construction.
2 parents c218643 + be5a5b7 commit 328306a

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

library/alloc/src/boxed.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,7 @@ unsafe impl<#[may_dangle] T: ?Sized, A: Allocator> Drop for Box<T, A> {
10861086
}
10871087
}
10881088

1089+
#[cfg(not(no_global_oom_handling))]
10891090
#[stable(feature = "rust1", since = "1.0.0")]
10901091
impl<T: Default> Default for Box<T> {
10911092
/// Creates a `Box<T>`, with the `Default` value for T.
@@ -1394,6 +1395,7 @@ impl<A: Allocator> From<Box<str, A>> for Box<[u8], A> {
13941395
}
13951396
}
13961397

1398+
#[cfg(not(no_global_oom_handling))]
13971399
#[stable(feature = "box_from_array", since = "1.45.0")]
13981400
impl<T, const N: usize> From<[T; N]> for Box<[T]> {
13991401
/// Converts a `[T; N]` into a `Box<[T]>`

library/alloc/src/vec/mod.rs

+1
Original file line numberDiff line numberDiff line change
@@ -2841,6 +2841,7 @@ impl<T: Clone> From<&mut [T]> for Vec<T> {
28412841
}
28422842
}
28432843

2844+
#[cfg(not(no_global_oom_handling))]
28442845
#[stable(feature = "vec_from_array", since = "1.44.0")]
28452846
impl<T, const N: usize> From<[T; N]> for Vec<T> {
28462847
#[cfg(not(test))]

0 commit comments

Comments
 (0)