diff options
| author | bors <bors@rust-lang.org> | 2025-03-08 12:30:31 +0000 | 
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-03-08 12:30:31 +0000 | 
| commit | 79b43dfde9dd1e3bed3c6ef7e9cfc708422f671f (patch) | |
| tree | e24140795e20b8859c497e2557bac36c31a88c7a /library/alloc/src/lib.rs | |
| parent | cdd8af229960d05c8dfe5ca3e5f5e2066e676213 (diff) | |
| parent | 6576d35aef7f448c4f2322ffc87375fd0ff01c48 (diff) | |
| download | rust-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/lib.rs')
| -rw-r--r-- | library/alloc/src/lib.rs | 39 | 
1 files changed, 2 insertions, 37 deletions
| diff --git a/library/alloc/src/lib.rs b/library/alloc/src/lib.rs index 265b68d3b0e..f0cdb1e4e0f 100644 --- a/library/alloc/src/lib.rs +++ b/library/alloc/src/lib.rs @@ -93,7 +93,6 @@ // // Library features: // tidy-alphabetical-start -#![cfg_attr(test, feature(str_as_str))] #![feature(alloc_layout_extra)] #![feature(allocator_api)] #![feature(array_chunks)] @@ -161,13 +160,11 @@ // // Language features: // tidy-alphabetical-start -#![cfg_attr(not(test), feature(coroutine_trait))] -#![cfg_attr(test, feature(panic_update_hook))] -#![cfg_attr(test, feature(test))] #![feature(allocator_internals)] #![feature(allow_internal_unstable)] #![feature(cfg_sanitize)] #![feature(const_precise_live_drops)] +#![feature(coroutine_trait)] #![feature(decl_macro)] #![feature(dropck_eyepatch)] #![feature(fundamental)] @@ -200,15 +197,6 @@ // from other crates, but since this can only appear for lang items, it doesn't seem worth fixing. #![feature(intra_doc_pointers)] -// Allow testing this library -#[cfg(test)] -#[macro_use] -extern crate std; -#[cfg(test)] -extern crate test; -#[cfg(test)] -mod testing; - // Module with internal macros used by other modules (needs to be included before other modules). #[macro_use] mod macros; @@ -216,7 +204,6 @@ mod macros; mod raw_vec; // Heaps provided for low-level allocation strategies - pub mod alloc; // Primitive types using the heaps above @@ -224,13 +211,8 @@ pub mod alloc; // Need to conditionally define the mod from `boxed.rs` to avoid // duplicating the lang-items when building in test cfg; but also need // to allow code to have `use boxed::Box;` declarations. -#[cfg(not(test))] -pub mod boxed; -#[cfg(test)] -mod boxed { - pub(crate) use std::boxed::Box; -} pub mod borrow; +pub mod boxed; #[unstable(feature = "bstr", issue = "134915")] pub mod bstr; pub mod collections; @@ -254,20 +236,3 @@ pub mod __export { pub use core::format_args; pub use core::hint::must_use; } - -#[cfg(test)] -#[allow(dead_code)] // Not used in all configurations -pub(crate) mod test_helpers { - /// Copied from `std::test_helpers::test_rng`, since these tests rely on the - /// seed not being the same for every RNG invocation too. - pub(crate) fn test_rng() -> rand_xorshift::XorShiftRng { - use std::hash::{BuildHasher, Hash, Hasher}; - let mut hasher = std::hash::RandomState::new().build_hasher(); - std::panic::Location::caller().hash(&mut hasher); - let hc64 = hasher.finish(); - let seed_vec = - hc64.to_le_bytes().into_iter().chain(0u8..8).collect::<crate::vec::Vec<u8>>(); - let seed: [u8; 16] = seed_vec.as_slice().try_into().unwrap(); - rand::SeedableRng::from_seed(seed) - } -} | 
