| 1 | |
| 2 |
|
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 |
|
| 61 | #![allow(unused_attributes)]
|
| 62 | #![stable(feature = "alloc", since = "1.36.0")]
|
| 63 | #![doc(
|
| 64 | html_playground_url = "https://play.rust-lang.org/",
|
| 65 | issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
|
| 66 | test(no_crate_inject, attr(allow(unused_variables), deny(warnings)))
|
| 67 | )]
|
| 68 | #![doc(cfg_hide(
|
| 69 | not(test),
|
| 70 | not(any(test, bootstrap)),
|
| 71 | any(not(feature = "miri-test-libstd"), test, doctest),
|
| 72 | no_global_oom_handling,
|
| 73 | not(no_global_oom_handling),
|
| 74 | not(no_rc),
|
| 75 | not(no_sync),
|
| 76 | target_has_atomic = "ptr"
|
| 77 | ))]
|
| 78 | #![no_std]
|
| 79 | #![needs_allocator]
|
| 80 | |
| 81 | |
| 82 | |
| 83 | #![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
|
| 84 | |
| 85 | |
| 86 | #![deny(unsafe_op_in_unsafe_fn)]
|
| 87 | #![deny(fuzzy_provenance_casts)]
|
| 88 | #![warn(deprecated_in_future)]
|
| 89 | #![warn(missing_debug_implementations)]
|
| 90 | #![warn(missing_docs)]
|
| 91 | #![allow(explicit_outlives_requirements)]
|
| 92 | |
| 93 | |
| 94 | #![feature(alloc_layout_extra)]
|
| 95 | #![feature(allocator_api)]
|
| 96 | #![feature(array_chunks)]
|
| 97 | #![feature(array_into_iter_constructors)]
|
| 98 | #![feature(array_methods)]
|
| 99 | #![feature(array_windows)]
|
| 100 | #![feature(assert_matches)]
|
| 101 | #![feature(async_iterator)]
|
| 102 | #![feature(coerce_unsized)]
|
| 103 | #![cfg_attr(not(no_global_oom_handling), feature(const_alloc_error))]
|
| 104 | #![feature(const_box)]
|
| 105 | #![cfg_attr(not(no_global_oom_handling), feature(const_btree_len))]
|
| 106 | #![cfg_attr(not(no_borrow), feature(const_cow_is_borrowed))]
|
| 107 | #![feature(const_convert)]
|
| 108 | #![feature(const_size_of_val)]
|
| 109 | #![feature(const_align_of_val)]
|
| 110 | #![feature(const_ptr_read)]
|
| 111 | #![feature(const_maybe_uninit_zeroed)]
|
| 112 | #![feature(const_maybe_uninit_write)]
|
| 113 | #![feature(const_maybe_uninit_as_mut_ptr)]
|
| 114 | #![feature(const_refs_to_cell)]
|
| 115 | #![feature(core_intrinsics)]
|
| 116 | #![feature(core_panic)]
|
| 117 | #![feature(const_eval_select)]
|
| 118 | #![feature(const_pin)]
|
| 119 | #![feature(const_waker)]
|
| 120 | #![feature(cstr_from_bytes_until_nul)]
|
| 121 | #![feature(dispatch_from_dyn)]
|
| 122 | #![feature(error_generic_member_access)]
|
| 123 | #![feature(error_in_core)]
|
| 124 | #![feature(exact_size_is_empty)]
|
| 125 | #![feature(extend_one)]
|
| 126 | #![feature(fmt_internals)]
|
| 127 | #![feature(fn_traits)]
|
| 128 | #![feature(hasher_prefixfree_extras)]
|
| 129 | #![feature(inline_const)]
|
| 130 | #![feature(inplace_iteration)]
|
| 131 | #![cfg_attr(test, feature(is_sorted))]
|
| 132 | #![feature(iter_advance_by)]
|
| 133 | #![feature(iter_next_chunk)]
|
| 134 | #![feature(iter_repeat_n)]
|
| 135 | #![feature(layout_for_ptr)]
|
| 136 | #![feature(maybe_uninit_slice)]
|
| 137 | #![feature(maybe_uninit_uninit_array)]
|
| 138 | #![feature(maybe_uninit_uninit_array_transpose)]
|
| 139 | #![cfg_attr(test, feature(new_uninit))]
|
| 140 | #![feature(nonnull_slice_from_raw_parts)]
|
| 141 | #![feature(pattern)]
|
| 142 | #![feature(pointer_byte_offsets)]
|
| 143 | #![feature(provide_any)]
|
| 144 | #![feature(ptr_internals)]
|
| 145 | #![feature(ptr_metadata)]
|
| 146 | #![feature(ptr_sub_ptr)]
|
| 147 | #![feature(receiver_trait)]
|
| 148 | #![feature(saturating_int_impl)]
|
| 149 | #![feature(set_ptr_value)]
|
| 150 | #![feature(sized_type_properties)]
|
| 151 | #![feature(slice_from_ptr_range)]
|
| 152 | #![feature(slice_group_by)]
|
| 153 | #![feature(slice_ptr_get)]
|
| 154 | #![feature(slice_ptr_len)]
|
| 155 | #![feature(slice_range)]
|
| 156 | #![feature(str_internals)]
|
| 157 | #![feature(strict_provenance)]
|
| 158 | #![feature(trusted_len)]
|
| 159 | #![feature(trusted_random_access)]
|
| 160 | #![feature(try_trait_v2)]
|
| 161 | #![feature(tuple_trait)]
|
| 162 | #![feature(unchecked_math)]
|
| 163 | #![feature(unicode_internals)]
|
| 164 | #![feature(unsize)]
|
| 165 | #![feature(utf8_chunks)]
|
| 166 | #![feature(std_internals)]
|
| 167 | |
| 168 | |
| 169 | #![feature(allocator_internals)]
|
| 170 | #![feature(allow_internal_unstable)]
|
| 171 | #![feature(associated_type_bounds)]
|
| 172 | #![feature(cfg_sanitize)]
|
| 173 | #![feature(const_deref)]
|
| 174 | #![feature(const_mut_refs)]
|
| 175 | #![feature(const_ptr_write)]
|
| 176 | #![feature(const_precise_live_drops)]
|
| 177 | #![feature(const_trait_impl)]
|
| 178 | #![feature(const_try)]
|
| 179 | #![feature(dropck_eyepatch)]
|
| 180 | #![feature(exclusive_range_pattern)]
|
| 181 | #![feature(fundamental)]
|
| 182 | #![cfg_attr(not(test), feature(generator_trait))]
|
| 183 | #![feature(hashmap_internals)]
|
| 184 | #![feature(lang_items)]
|
| 185 | #![feature(min_specialization)]
|
| 186 | #![feature(negative_impls)]
|
| 187 | #![feature(never_type)]
|
| 188 | #![feature(rustc_allow_const_fn_unstable)]
|
| 189 | #![feature(rustc_attrs)]
|
| 190 | #![feature(pointer_is_aligned)]
|
| 191 | #![feature(slice_internals)]
|
| 192 | #![feature(staged_api)]
|
| 193 | #![feature(stmt_expr_attributes)]
|
| 194 | #![cfg_attr(test, feature(test))]
|
| 195 | #![feature(unboxed_closures)]
|
| 196 | #![feature(unsized_fn_params)]
|
| 197 | #![feature(c_unwind)]
|
| 198 | #![feature(with_negative_coherence)]
|
| 199 | #![cfg_attr(test, feature(panic_update_hook))]
|
| 200 | |
| 201 | |
| 202 | #![feature(doc_cfg)]
|
| 203 | #![feature(doc_cfg_hide)]
|
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | #![feature(intra_doc_pointers)]
|
| 209 |
|
| 210 | |
| 211 | #[cfg(test)]
|
| 212 | #[macro_use]
|
| 213 | extern crate std;
|
| 214 | #[cfg(test)]
|
| 215 | extern crate test;
|
| 216 | #[cfg(test)]
|
| 217 | mod testing;
|
| 218 |
|
| 219 | |
| 220 | #[cfg(not(no_macros))]
|
| 221 | #[macro_use]
|
| 222 | mod macros;
|
| 223 |
|
| 224 | mod raw_vec;
|
| 225 |
|
| 226 | |
| 227 |
|
| 228 | pub mod alloc;
|
| 229 |
|
| 230 | |
| 231 |
|
| 232 | |
| 233 | |
| 234 | |
| 235 | #[cfg(not(test))]
|
| 236 | pub mod boxed;
|
| 237 | #[cfg(test)]
|
| 238 | mod boxed {
|
| 239 | pub use std::boxed::Box;
|
| 240 | }
|
| 241 | #[cfg(not(no_borrow))]
|
| 242 | pub mod borrow;
|
| 243 | pub mod collections;
|
| 244 | #[cfg(all(not(no_rc), not(no_sync), not(no_global_oom_handling)))]
|
| 245 | pub mod ffi;
|
| 246 | #[cfg(not(no_fmt))]
|
| 247 | pub mod fmt;
|
| 248 | #[cfg(not(no_rc))]
|
| 249 | pub mod rc;
|
| 250 | pub mod slice;
|
| 251 | #[cfg(not(no_str))]
|
| 252 | pub mod str;
|
| 253 | #[cfg(not(no_string))]
|
| 254 | pub mod string;
|
| 255 | #[cfg(all(not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
|
| 256 | pub mod sync;
|
| 257 | #[cfg(all(not(no_global_oom_handling), not(no_rc), not(no_sync), target_has_atomic = "ptr"))]
|
| 258 | pub mod task;
|
| 259 | #[cfg(test)]
|
| 260 | mod tests;
|
| 261 | pub mod vec;
|
| 262 |
|
| 263 | #[doc(hidden)]
|
| 264 | #[unstable(feature = "liballoc_internals", issue = "none", reason = "implementation detail")]
|
| 265 | pub mod __export {
|
| 266 | pub use core::format_args;
|
| 267 | }
|
| 268 |
|
| 269 | #[cfg(test)]
|
| 270 | #[allow(dead_code)] |
| 271 | pub(crate) mod test_helpers {
|
| 272 | |
| 273 | |
| 274 | pub(crate) fn test_rng() -> rand_xorshift::XorShiftRng {
|
| 275 | use std::hash::{BuildHasher, Hash, Hasher};
|
| 276 | let mut hasher = std::collections::hash_map::RandomState::new().build_hasher();
|
| 277 | std::panic::Location::caller().hash(&mut hasher);
|
| 278 | let hc64 = hasher.finish();
|
| 279 | let seed_vec =
|
| 280 | hc64.to_le_bytes().into_iter().chain(0u8..8).collect::<crate::vec::Vec<u8>>();
|
| 281 | let seed: [u8; 16] = seed_vec.as_slice().try_into().unwrap();
|
| 282 | rand::SeedableRng::from_seed(seed)
|
| 283 | }
|
| 284 | }
|