diff --git a/alloc/src/macros.rs b/alloc/src/macros.rs index d3e9e65c3..22c19243e 100644 --- a/alloc/src/macros.rs +++ b/alloc/src/macros.rs @@ -34,7 +34,7 @@ /// be mindful of side effects. /// /// [`Vec`]: crate::vec::Vec -#[cfg(not(test))] +#[cfg(all(not(no_global_oom_handling), not(test)))] #[macro_export] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_diagnostic_item = "vec_macro"] @@ -55,7 +55,7 @@ macro_rules! vec { // required for this macro definition, is not available. Instead use the // `slice::into_vec` function which is only available with cfg(test) // NB see the slice::hack module in slice.rs for more information -#[cfg(test)] +#[cfg(all(not(no_global_oom_handling), test))] macro_rules! vec { () => ( $crate::vec::Vec::new()