about summary refs log tree commit diff
path: root/library/alloc/src/macros.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-03-08 12:30:31 +0000
committerbors <bors@rust-lang.org>2025-03-08 12:30:31 +0000
commit79b43dfde9dd1e3bed3c6ef7e9cfc708422f671f (patch)
treee24140795e20b8859c497e2557bac36c31a88c7a /library/alloc/src/macros.rs
parentcdd8af229960d05c8dfe5ca3e5f5e2066e676213 (diff)
parent6576d35aef7f448c4f2322ffc87375fd0ff01c48 (diff)
downloadrust-79b43dfde9dd1e3bed3c6ef7e9cfc708422f671f.tar.gz
rust-79b43dfde9dd1e3bed3c6ef7e9cfc708422f671f.zip
Auto merge of #138208 - jhpratt:rollup-hlqyu51, r=jhpratt
Rollup of 5 pull requests

Successful merges:

 - #136642 (Put the alloc unit tests in a separate alloctests package)
 - #137528 (Windows: Fix error in `fs::rename` on Windows 1607)
 - #137685 (self-contained linker: conservatively default to `-znostart-stop-gc` on x64 linux)
 - #137757 (On long spans, trim the middle of them to make them fit in the terminal width)
 - #138189 (Mention `env` and `option_env` macros in `std::env::var` docs)

r? `@ghost`
`@rustbot` modify labels: rollup
Diffstat (limited to 'library/alloc/src/macros.rs')
-rw-r--r--library/alloc/src/macros.rs23
1 files changed, 2 insertions, 21 deletions
diff --git a/library/alloc/src/macros.rs b/library/alloc/src/macros.rs
index c000fd6f4ef..214192b8c9a 100644
--- a/library/alloc/src/macros.rs
+++ b/library/alloc/src/macros.rs
@@ -34,7 +34,7 @@
 /// be mindful of side effects.
 ///
 /// [`Vec`]: crate::vec::Vec
-#[cfg(all(not(no_global_oom_handling), not(test)))]
+#[cfg(not(no_global_oom_handling))]
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[rustc_diagnostic_item = "vec_macro"]
@@ -55,25 +55,6 @@ macro_rules! vec {
     );
 }
 
-// HACK(japaric): with cfg(test) the inherent `[T]::into_vec` method, which is
-// 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(all(not(no_global_oom_handling), test))]
-#[allow(unused_macro_rules)]
-macro_rules! vec {
-    () => (
-        $crate::vec::Vec::new()
-    );
-    ($elem:expr; $n:expr) => (
-        $crate::vec::from_elem($elem, $n)
-    );
-    ($($x:expr),*) => (
-        $crate::slice::into_vec($crate::boxed::Box::new([$($x),*]))
-    );
-    ($($x:expr,)*) => (vec![$($x),*])
-}
-
 /// Creates a `String` using interpolation of runtime expressions.
 ///
 /// The first argument `format!` receives is a format string. This must be a string
@@ -120,7 +101,7 @@ macro_rules! vec {
 #[macro_export]
 #[stable(feature = "rust1", since = "1.0.0")]
 #[allow_internal_unstable(hint_must_use, liballoc_internals)]
-#[cfg_attr(not(test), rustc_diagnostic_item = "format_macro")]
+#[rustc_diagnostic_item = "format_macro"]
 macro_rules! format {
     ($($arg:tt)*) => {
         $crate::__export::must_use({