1#![allow(unused_attributes)]
60#![stable(feature = "alloc", since = "1.36.0")]
61#![doc(
62 html_playground_url = "https://play.rust-lang.org/",
63 issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
64 test(no_crate_inject, attr(allow(unused_variables), deny(warnings)))
65)]
66#![doc(cfg_hide(
67 not(test),
68 not(any(test, bootstrap)),
69 no_global_oom_handling,
70 not(no_global_oom_handling),
71 not(no_rc),
72 not(no_sync),
73 target_has_atomic = "ptr"
74))]
75#![doc(rust_logo)]
76#![feature(rustdoc_internals)]
77#![no_std]
78#![needs_allocator]
79#![deny(unsafe_op_in_unsafe_fn)]
81#![deny(fuzzy_provenance_casts)]
82#![warn(deprecated_in_future)]
83#![warn(missing_debug_implementations)]
84#![warn(missing_docs)]
85#![allow(explicit_outlives_requirements)]
86#![warn(multiple_supertrait_upcastable)]
87#![allow(internal_features)]
88#![allow(rustdoc::redundant_explicit_links)]
89#![warn(rustdoc::unescaped_backticks)]
90#![deny(ffi_unwind_calls)]
91#![warn(unreachable_pub)]
92#![cfg_attr(test, feature(str_as_str))]
96#![feature(alloc_layout_extra)]
97#![feature(allocator_api)]
98#![feature(array_chunks)]
99#![feature(array_into_iter_constructors)]
100#![feature(array_windows)]
101#![feature(ascii_char)]
102#![feature(assert_matches)]
103#![feature(async_fn_traits)]
104#![feature(async_iterator)]
105#![feature(box_uninit_write)]
106#![feature(bstr)]
107#![feature(bstr_internals)]
108#![feature(clone_to_uninit)]
109#![feature(coerce_unsized)]
110#![feature(const_eval_select)]
111#![feature(const_heap)]
112#![feature(core_intrinsics)]
113#![feature(deprecated_suggestion)]
114#![feature(deref_pure_trait)]
115#![feature(dispatch_from_dyn)]
116#![feature(error_generic_member_access)]
117#![feature(exact_size_is_empty)]
118#![feature(extend_one)]
119#![feature(extend_one_unchecked)]
120#![feature(fmt_internals)]
121#![feature(fn_traits)]
122#![feature(formatting_options)]
123#![feature(hasher_prefixfree_extras)]
124#![feature(inplace_iteration)]
125#![feature(iter_advance_by)]
126#![feature(iter_next_chunk)]
127#![feature(layout_for_ptr)]
128#![feature(legacy_receiver_trait)]
129#![feature(local_waker)]
130#![feature(maybe_uninit_slice)]
131#![feature(maybe_uninit_uninit_array_transpose)]
132#![feature(nonnull_provenance)]
133#![feature(panic_internals)]
134#![feature(pattern)]
135#![feature(pin_coerce_unsized_trait)]
136#![feature(pointer_like_trait)]
137#![feature(ptr_internals)]
138#![feature(ptr_metadata)]
139#![feature(ptr_sub_ptr)]
140#![feature(set_ptr_value)]
141#![feature(sized_type_properties)]
142#![feature(slice_from_ptr_range)]
143#![feature(slice_index_methods)]
144#![feature(slice_iter_mut_as_mut_slice)]
145#![feature(slice_ptr_get)]
146#![feature(slice_range)]
147#![feature(std_internals)]
148#![feature(str_internals)]
149#![feature(temporary_niche_types)]
150#![feature(trusted_fused)]
151#![feature(trusted_len)]
152#![feature(trusted_random_access)]
153#![feature(try_trait_v2)]
154#![feature(try_with_capacity)]
155#![feature(tuple_trait)]
156#![feature(unicode_internals)]
157#![feature(unsize)]
158#![feature(unwrap_infallible)]
159#![cfg_attr(not(test), feature(coroutine_trait))]
164#![cfg_attr(test, feature(panic_update_hook))]
165#![cfg_attr(test, feature(test))]
166#![feature(allocator_internals)]
167#![feature(allow_internal_unstable)]
168#![feature(cfg_sanitize)]
169#![feature(const_precise_live_drops)]
170#![feature(decl_macro)]
171#![feature(dropck_eyepatch)]
172#![feature(fundamental)]
173#![feature(hashmap_internals)]
174#![feature(intrinsics)]
175#![feature(lang_items)]
176#![feature(min_specialization)]
177#![feature(multiple_supertrait_upcastable)]
178#![feature(negative_impls)]
179#![feature(never_type)]
180#![feature(optimize_attribute)]
181#![feature(rustc_allow_const_fn_unstable)]
182#![feature(rustc_attrs)]
183#![feature(slice_internals)]
184#![feature(staged_api)]
185#![feature(stmt_expr_attributes)]
186#![feature(strict_provenance_lints)]
187#![feature(unboxed_closures)]
188#![feature(unsized_fn_params)]
189#![feature(with_negative_coherence)]
190#![rustc_preserve_ub_checks]
191#![feature(doc_cfg)]
195#![feature(doc_cfg_hide)]
196#![feature(intra_doc_pointers)]
201
202#[cfg(test)]
204#[macro_use]
205extern crate std;
206#[cfg(test)]
207extern crate test;
208#[cfg(test)]
209mod testing;
210
211#[macro_use]
213mod macros;
214
215mod raw_vec;
216
217pub mod alloc;
220
221#[cfg(not(test))]
227pub mod boxed;
228#[cfg(test)]
229mod boxed {
230 pub(crate) use std::boxed::Box;
231}
232pub mod borrow;
233#[unstable(feature = "bstr", issue = "134915")]
234pub mod bstr;
235pub mod collections;
236#[cfg(all(not(no_rc), not(no_sync), not(no_global_oom_handling)))]
237pub mod ffi;
238pub mod fmt;
239#[cfg(not(no_rc))]
240pub mod rc;
241pub mod slice;
242pub mod str;
243pub mod string;
244#[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
245pub mod sync;
246#[cfg(all(not(no_global_oom_handling), not(no_rc), not(no_sync)))]
247pub mod task;
248pub mod vec;
249
250#[doc(hidden)]
251#[unstable(feature = "liballoc_internals", issue = "none", reason = "implementation detail")]
252pub mod __export {
253 pub use core::format_args;
254 pub use core::hint::must_use;
255}
256
257#[cfg(test)]
258#[allow(dead_code)] pub(crate) mod test_helpers {
260 pub(crate) fn test_rng() -> rand_xorshift::XorShiftRng {
263 use std::hash::{BuildHasher, Hash, Hasher};
264 let mut hasher = std::hash::RandomState::new().build_hasher();
265 std::panic::Location::caller().hash(&mut hasher);
266 let hc64 = hasher.finish();
267 let seed_vec =
268 hc64.to_le_bytes().into_iter().chain(0u8..8).collect::<crate::vec::Vec<u8>>();
269 let seed: [u8; 16] = seed_vec.as_slice().try_into().unwrap();
270 rand::SeedableRng::from_seed(seed)
271 }
272}