2014-05-22 09:44:54 -07:00
|
|
|
//! # The Rust Core Library
|
2014-05-12 21:22:35 -07:00
|
|
|
//!
|
2015-11-05 14:33:30 +01:00
|
|
|
//! The Rust Core Library is the dependency-free[^free] foundation of [The
|
2014-05-19 21:53:00 -07:00
|
|
|
//! Rust Standard Library](../std/index.html). It is the portable glue
|
|
|
|
//! between the language and its libraries, defining the intrinsic and
|
|
|
|
//! primitive building blocks of all Rust code. It links to no
|
2014-05-20 11:39:40 -07:00
|
|
|
//! upstream libraries, no system libraries, and no libc.
|
2014-05-19 21:53:00 -07:00
|
|
|
//!
|
2015-11-05 14:33:30 +01:00
|
|
|
//! [^free]: Strictly speaking, there are some symbols which are needed but
|
2015-11-18 11:35:29 +01:00
|
|
|
//! they aren't always necessary.
|
2015-11-05 14:33:30 +01:00
|
|
|
//!
|
2014-05-19 21:53:00 -07:00
|
|
|
//! The core library is *minimal*: it isn't even aware of heap allocation,
|
|
|
|
//! nor does it provide concurrency or I/O. These things require
|
2014-05-20 11:39:40 -07:00
|
|
|
//! platform integration, and this library is platform-agnostic.
|
2014-05-19 21:53:00 -07:00
|
|
|
//!
|
|
|
|
//! # How to use the core library
|
|
|
|
//!
|
2016-07-15 13:17:35 -04:00
|
|
|
//! Please note that all of these details are currently not considered stable.
|
|
|
|
//!
|
2014-05-20 10:40:14 -07:00
|
|
|
// FIXME: Fill me in with more detail when the interface settles
|
2014-05-19 21:53:00 -07:00
|
|
|
//! This library is built on the assumption of a few existing symbols:
|
2014-05-12 21:22:35 -07:00
|
|
|
//!
|
2023-08-03 14:05:18 +02:00
|
|
|
//! * `memcpy`, `memmove`, `memset`, `memcmp`, `bcmp`, `strlen` - These are core memory routines
|
|
|
|
//! which are generated by Rust codegen backends. Additionally, this library can make explicit
|
|
|
|
//! calls to `strlen`. Their signatures are the same as found in C, but there are extra
|
|
|
|
//! assumptions about their semantics: For `memcpy`, `memmove`, `memset`, `memcmp`, and `bcmp`, if
|
2023-11-24 21:23:45 +01:00
|
|
|
//! the `n` parameter is 0, the function is assumed to not be UB, even if the pointers are NULL or
|
|
|
|
//! dangling. (Note that making extra assumptions about these functions is common among compilers:
|
2023-11-24 11:15:53 +01:00
|
|
|
//! [clang](https://reviews.llvm.org/D86993) and [GCC](https://gcc.gnu.org/onlinedocs/gcc/Standards.html#C-Language) do the same.)
|
2023-08-03 14:05:18 +02:00
|
|
|
//! These functions are often provided by the system libc, but can also be provided by the
|
|
|
|
//! [compiler-builtins crate](https://crates.io/crates/compiler_builtins).
|
2023-08-15 13:39:46 +02:00
|
|
|
//! Note that the library does not guarantee that it will always make these assumptions, so Rust
|
|
|
|
//! user code directly calling the C functions should follow the C specification! The advice for
|
|
|
|
//! Rust user code is to call the functions provided by this library instead (such as
|
|
|
|
//! `ptr::copy`).
|
2014-05-12 21:22:35 -07:00
|
|
|
//!
|
2017-06-28 02:41:24 +02:00
|
|
|
//! * `rust_begin_panic` - This function takes four arguments, a
|
|
|
|
//! `fmt::Arguments`, a `&'static str`, and two `u32`'s. These four arguments
|
2016-07-15 13:17:35 -04:00
|
|
|
//! dictate the panic message, the file at which panic was invoked, and the
|
2017-06-27 04:26:52 +02:00
|
|
|
//! line and column inside the file. It is up to consumers of this core
|
|
|
|
//! library to define this panic function; it is only required to never
|
2018-04-30 10:57:11 +02:00
|
|
|
//! return. This requires a `lang` attribute named `panic_impl`.
|
2016-08-14 13:33:53 +02:00
|
|
|
//!
|
|
|
|
//! * `rust_eh_personality` - is used by the failure mechanisms of the
|
|
|
|
//! compiler. This is often mapped to GCC's personality function, but crates
|
|
|
|
//! which do not trigger a panic can be assured that this function is never
|
|
|
|
//! called. The `lang` attribute is called `eh_personality`.
|
2014-06-28 13:57:36 -07:00
|
|
|
|
2022-10-28 16:48:00 -07:00
|
|
|
// Since core defines many fundamental lang items, all tests live in a
|
2022-11-03 15:59:23 -07:00
|
|
|
// separate crate, libcoretest (library/core/tests), to avoid bizarre issues.
|
2018-05-06 03:29:19 +08:00
|
|
|
//
|
|
|
|
// Here we explicitly #[cfg]-out this whole crate when testing. If we don't do
|
|
|
|
// this, both the generated test artifact and the linked libtest (which
|
2022-10-28 16:48:00 -07:00
|
|
|
// transitively includes core) will both define the same set of lang items,
|
2020-01-10 14:36:22 +00:00
|
|
|
// and this will cause the E0152 "found duplicate lang item" error. See
|
2018-05-06 03:29:19 +08:00
|
|
|
// discussion in #50466 for details.
|
|
|
|
//
|
|
|
|
// This cfg won't affect doc tests.
|
2018-05-06 01:02:05 +08:00
|
|
|
#![cfg(not(test))]
|
2022-10-28 16:48:00 -07:00
|
|
|
// To run core tests without x.py without ending up with two copies of core, Miri needs to be
|
2021-07-18 17:21:59 +02:00
|
|
|
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
|
2023-08-15 19:30:09 +02:00
|
|
|
// rustc itself never sets the feature, so this line has no effect there.
|
2021-07-18 17:21:59 +02:00
|
|
|
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
|
2015-12-02 17:31:49 -08:00
|
|
|
#![stable(feature = "core", since = "1.6.0")]
|
2019-12-22 17:42:04 -05:00
|
|
|
#![doc(
|
|
|
|
html_playground_url = "https://play.rust-lang.org/",
|
|
|
|
issue_tracker_base_url = "https://github.com/rust-lang/rust/issues/",
|
|
|
|
test(no_crate_inject, attr(deny(warnings))),
|
|
|
|
test(attr(allow(dead_code, deprecated, unused_variables, unused_mut)))
|
|
|
|
)]
|
2023-11-13 07:39:17 -05:00
|
|
|
#![doc(rust_logo)]
|
2022-01-14 09:50:49 +01:00
|
|
|
#![doc(cfg_hide(
|
|
|
|
not(test),
|
|
|
|
any(not(feature = "miri-test-libstd"), test, doctest),
|
|
|
|
no_fp_fmt_parse,
|
|
|
|
target_pointer_width = "16",
|
|
|
|
target_pointer_width = "32",
|
|
|
|
target_pointer_width = "64",
|
|
|
|
target_has_atomic = "8",
|
|
|
|
target_has_atomic = "16",
|
|
|
|
target_has_atomic = "32",
|
|
|
|
target_has_atomic = "64",
|
|
|
|
target_has_atomic = "ptr",
|
|
|
|
target_has_atomic_equal_alignment = "8",
|
|
|
|
target_has_atomic_equal_alignment = "16",
|
|
|
|
target_has_atomic_equal_alignment = "32",
|
|
|
|
target_has_atomic_equal_alignment = "64",
|
|
|
|
target_has_atomic_equal_alignment = "ptr",
|
|
|
|
target_has_atomic_load_store = "8",
|
|
|
|
target_has_atomic_load_store = "16",
|
|
|
|
target_has_atomic_load_store = "32",
|
|
|
|
target_has_atomic_load_store = "64",
|
|
|
|
target_has_atomic_load_store = "ptr",
|
|
|
|
))]
|
2015-08-11 14:31:23 -07:00
|
|
|
#![no_core]
|
2022-04-05 22:42:23 +02:00
|
|
|
#![rustc_coherence_is_core]
|
2021-08-04 18:24:57 +02:00
|
|
|
//
|
2021-08-04 17:54:07 +02:00
|
|
|
// Lints:
|
|
|
|
#![deny(rust_2021_incompatible_or_patterns)]
|
|
|
|
#![deny(unsafe_op_in_unsafe_fn)]
|
2022-11-20 11:28:08 +01:00
|
|
|
#![deny(fuzzy_provenance_casts)]
|
2018-12-21 11:08:26 +01:00
|
|
|
#![warn(deprecated_in_future)]
|
2019-01-28 10:49:11 +01:00
|
|
|
#![warn(missing_debug_implementations)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![warn(missing_docs)]
|
2019-04-15 11:23:21 +09:00
|
|
|
#![allow(explicit_outlives_requirements)]
|
2022-08-18 19:39:14 +00:00
|
|
|
#![allow(incomplete_features)]
|
2023-03-07 08:39:30 -05:00
|
|
|
#![warn(multiple_supertrait_upcastable)]
|
2023-08-22 07:06:38 -04:00
|
|
|
#![allow(internal_features)]
|
2023-12-16 01:49:01 +00:00
|
|
|
#![deny(ffi_unwind_calls)]
|
2023-07-03 10:30:29 +08:00
|
|
|
// Do not check link redundancy on bootstraping phase
|
2023-08-22 07:06:38 -04:00
|
|
|
#![allow(rustdoc::redundant_explicit_links)]
|
2021-08-04 18:24:57 +02:00
|
|
|
//
|
2022-03-07 16:36:13 -05:00
|
|
|
// Library features:
|
2023-04-13 00:36:40 -07:00
|
|
|
// tidy-alphabetical-start
|
2024-03-19 09:34:31 -04:00
|
|
|
#![cfg_attr(bootstrap, feature(associated_type_bounds))]
|
2023-12-29 15:32:09 +00:00
|
|
|
#![feature(array_ptr_get)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(char_indices_offset)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_align_of_val)]
|
2022-09-23 15:14:34 -04:00
|
|
|
#![feature(const_align_of_val_raw)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(const_align_offset)]
|
2022-09-23 15:14:34 -04:00
|
|
|
#![feature(const_alloc_layout)]
|
2021-07-06 12:38:26 +00:00
|
|
|
#![feature(const_arguments_as_str)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(const_array_from_ref)]
|
2021-12-06 01:12:59 -08:00
|
|
|
#![feature(const_array_into_iter_constructors)]
|
2021-05-06 22:14:57 -04:00
|
|
|
#![feature(const_bigint_helper_methods)]
|
2021-12-23 20:07:41 +09:00
|
|
|
#![feature(const_black_box)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_caller_location)]
|
2020-11-04 11:41:57 +01:00
|
|
|
#![feature(const_cell_into_inner)]
|
2022-09-29 14:23:47 +02:00
|
|
|
#![feature(const_char_from_u32_unchecked)]
|
2021-10-19 07:37:25 +02:00
|
|
|
#![feature(const_eval_select)]
|
2022-10-07 20:57:34 +02:00
|
|
|
#![feature(const_exact_div)]
|
2020-08-22 12:24:35 -07:00
|
|
|
#![feature(const_float_bits_conv)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_float_classify)]
|
2021-10-25 17:07:16 +01:00
|
|
|
#![feature(const_fmt_arguments_new)]
|
2022-11-06 17:46:38 +01:00
|
|
|
#![feature(const_hash)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_heap)]
|
2024-01-13 20:10:00 +01:00
|
|
|
#![feature(const_hint_assert_unchecked)]
|
2022-06-04 16:23:15 -07:00
|
|
|
#![feature(const_index_range_slice_index)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_int_unchecked_arith)]
|
2023-11-14 09:31:41 +01:00
|
|
|
#![feature(const_intrinsic_copy)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_intrinsic_forget)]
|
2022-11-10 21:48:41 +01:00
|
|
|
#![feature(const_ipv4)]
|
|
|
|
#![feature(const_ipv6)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_likely)]
|
2021-11-14 00:36:19 -05:00
|
|
|
#![feature(const_maybe_uninit_as_mut_ptr)]
|
2022-03-31 12:04:14 -07:00
|
|
|
#![feature(const_maybe_uninit_assume_init)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(const_maybe_uninit_uninit_array)]
|
2022-04-13 15:50:23 +02:00
|
|
|
#![feature(const_nonnull_new)]
|
2021-12-17 20:01:19 +01:00
|
|
|
#![feature(const_num_midpoint)]
|
2020-07-01 15:07:23 +02:00
|
|
|
#![feature(const_option)]
|
2021-12-15 01:58:01 +08:00
|
|
|
#![feature(const_option_ext)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_pin)]
|
2022-10-07 22:24:31 +02:00
|
|
|
#![feature(const_pointer_is_aligned)]
|
2022-04-13 15:50:23 +02:00
|
|
|
#![feature(const_ptr_as_ref)]
|
2021-12-12 04:27:43 +09:00
|
|
|
#![feature(const_ptr_is_null)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(const_ptr_sub_ptr)]
|
2021-01-18 22:59:56 +01:00
|
|
|
#![feature(const_ptr_write)]
|
2020-07-16 09:12:59 -04:00
|
|
|
#![feature(const_raw_ptr_comparison)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(const_replace)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_size_of_val)]
|
2022-09-23 15:14:34 -04:00
|
|
|
#![feature(const_size_of_val_raw)]
|
2022-05-29 18:01:26 +02:00
|
|
|
#![feature(const_slice_from_raw_parts_mut)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(const_slice_from_ref)]
|
|
|
|
#![feature(const_slice_index)]
|
2020-05-06 07:43:18 +02:00
|
|
|
#![feature(const_slice_ptr_len)]
|
2022-09-14 16:54:49 +02:00
|
|
|
#![feature(const_slice_split_at_mut)]
|
2021-11-05 15:39:01 +03:00
|
|
|
#![feature(const_str_from_utf8_unchecked_mut)]
|
2023-09-22 16:42:08 -07:00
|
|
|
#![feature(const_strict_overflow_ops)]
|
2021-03-13 20:33:27 +01:00
|
|
|
#![feature(const_swap)]
|
2022-09-10 07:44:56 +00:00
|
|
|
#![feature(const_try)]
|
2020-09-23 08:39:19 +10:00
|
|
|
#![feature(const_type_id)]
|
2019-12-18 12:00:59 -05:00
|
|
|
#![feature(const_type_name)]
|
2024-03-15 22:09:05 -07:00
|
|
|
#![feature(const_typed_swap)]
|
2022-09-02 20:52:28 -07:00
|
|
|
#![feature(const_unicode_case_lookup)]
|
2022-03-29 19:30:55 +02:00
|
|
|
#![feature(const_unsafecell_get_mut)]
|
2022-09-14 14:15:44 +02:00
|
|
|
#![feature(const_waker)]
|
2023-10-03 22:27:25 -04:00
|
|
|
#![feature(coverage_attribute)]
|
2021-10-04 23:09:23 -04:00
|
|
|
#![feature(duration_consts_float)]
|
2023-03-03 11:29:21 +00:00
|
|
|
#![feature(internal_impls_macro)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(ip)]
|
2023-07-15 23:03:44 -04:00
|
|
|
#![feature(ip_bits)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(is_ascii_octdigit)]
|
2023-09-28 11:15:43 +02:00
|
|
|
#![feature(isqrt)]
|
2021-12-06 01:12:59 -08:00
|
|
|
#![feature(maybe_uninit_uninit_array)]
|
2023-11-07 23:55:00 +00:00
|
|
|
#![feature(non_null_convenience)]
|
2023-11-02 18:21:45 +00:00
|
|
|
#![feature(offset_of_enum)]
|
2024-02-05 07:34:48 -05:00
|
|
|
#![feature(offset_of_nested)]
|
2023-12-09 14:36:34 +01:00
|
|
|
#![feature(panic_internals)]
|
2022-09-21 13:43:21 -07:00
|
|
|
#![feature(ptr_alignment_type)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(ptr_metadata)]
|
2022-10-28 23:06:29 +04:00
|
|
|
#![feature(set_ptr_value)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(slice_ptr_get)]
|
2022-08-25 12:54:30 +02:00
|
|
|
#![feature(slice_split_at_unchecked)]
|
2023-12-03 15:18:21 +01:00
|
|
|
#![feature(split_at_checked)]
|
2021-11-05 15:39:01 +03:00
|
|
|
#![feature(str_internals)]
|
2022-04-04 17:04:58 +04:00
|
|
|
#![feature(str_split_inclusive_remainder)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(str_split_remainder)]
|
2022-11-20 11:28:08 +01:00
|
|
|
#![feature(strict_provenance)]
|
2023-09-06 23:24:23 -04:00
|
|
|
#![feature(unchecked_math)]
|
|
|
|
#![feature(unchecked_shifts)]
|
2022-03-07 16:36:13 -05:00
|
|
|
#![feature(utf16_extra)]
|
|
|
|
#![feature(utf16_extra_const)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(variant_count)]
|
2023-04-13 00:36:40 -07:00
|
|
|
// tidy-alphabetical-end
|
2021-08-04 18:24:57 +02:00
|
|
|
//
|
2021-08-04 17:54:07 +02:00
|
|
|
// Language features:
|
2023-04-13 00:36:40 -07:00
|
|
|
// tidy-alphabetical-start
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(abi_unadjusted)]
|
2022-08-18 19:39:14 +00:00
|
|
|
#![feature(adt_const_params)]
|
2021-08-05 11:58:52 -05:00
|
|
|
#![feature(allow_internal_unsafe)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(allow_internal_unstable)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(asm_const)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(auto_traits)]
|
2022-08-31 22:14:40 -07:00
|
|
|
#![feature(c_unwind)]
|
2022-07-12 09:41:47 -04:00
|
|
|
#![feature(cfg_sanitize)]
|
2022-02-15 21:40:07 -05:00
|
|
|
#![feature(cfg_target_has_atomic)]
|
2022-02-23 08:06:22 -05:00
|
|
|
#![feature(cfg_target_has_atomic_equal_alignment)]
|
2023-01-25 09:48:32 -05:00
|
|
|
#![feature(const_closures)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_fn_floating_point_arithmetic)]
|
2023-01-06 19:03:02 +00:00
|
|
|
#![feature(const_for)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(const_mut_refs)]
|
|
|
|
#![feature(const_precise_live_drops)]
|
|
|
|
#![feature(const_refs_to_cell)]
|
2023-04-16 09:16:22 +00:00
|
|
|
#![feature(const_trait_impl)]
|
2019-06-29 17:51:20 +03:00
|
|
|
#![feature(decl_macro)]
|
2022-04-05 22:42:23 +02:00
|
|
|
#![feature(deprecated_suggestion)]
|
2018-03-09 11:31:04 -08:00
|
|
|
#![feature(doc_cfg)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(doc_cfg_hide)]
|
2021-05-06 13:36:07 +02:00
|
|
|
#![feature(doc_notable_trait)]
|
2023-11-12 04:33:19 +00:00
|
|
|
#![feature(effects)]
|
2018-04-02 11:26:16 +02:00
|
|
|
#![feature(extern_types)]
|
2024-03-19 09:34:31 -04:00
|
|
|
#![feature(freeze_impls)]
|
2015-08-11 14:31:23 -07:00
|
|
|
#![feature(fundamental)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(generic_arg_infer)]
|
2021-08-16 17:29:49 +02:00
|
|
|
#![feature(if_let_guard)]
|
2022-10-20 00:30:00 -04:00
|
|
|
#![feature(inline_const)]
|
2020-12-19 08:23:59 -05:00
|
|
|
#![feature(intra_doc_pointers)]
|
2015-06-09 11:18:03 -07:00
|
|
|
#![feature(intrinsics)]
|
|
|
|
#![feature(lang_items)]
|
2023-05-12 19:37:02 -07:00
|
|
|
#![feature(let_chains)]
|
2018-02-17 17:23:19 -08:00
|
|
|
#![feature(link_llvm_intrinsics)]
|
2022-04-07 08:13:41 -03:00
|
|
|
#![feature(macro_metavar_expr)]
|
2024-03-19 09:34:31 -04:00
|
|
|
#![feature(min_exhaustive_patterns)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(min_specialization)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(multiple_supertrait_upcastable)]
|
2021-10-19 09:27:59 +02:00
|
|
|
#![feature(must_not_suspend)]
|
2020-04-22 15:45:35 -04:00
|
|
|
#![feature(negative_impls)]
|
2019-12-11 09:55:29 -05:00
|
|
|
#![feature(never_type)]
|
2015-08-11 14:31:23 -07:00
|
|
|
#![feature(no_core)]
|
2023-08-24 17:09:15 -07:00
|
|
|
#![feature(no_sanitize)]
|
2017-03-17 15:05:44 +01:00
|
|
|
#![feature(prelude_import)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(repr_simd)]
|
|
|
|
#![feature(rustc_allow_const_fn_unstable)]
|
2016-03-10 21:20:09 +02:00
|
|
|
#![feature(rustc_attrs)]
|
2023-04-13 00:36:40 -07:00
|
|
|
#![feature(rustdoc_internals)]
|
2018-02-17 17:23:19 -08:00
|
|
|
#![feature(simd_ffi)]
|
2015-01-30 12:26:44 -08:00
|
|
|
#![feature(staged_api)]
|
2018-02-17 17:23:19 -08:00
|
|
|
#![feature(stmt_expr_attributes)]
|
2023-03-02 13:41:17 +01:00
|
|
|
#![feature(target_feature_11)]
|
2020-10-19 15:38:11 +02:00
|
|
|
#![feature(trait_alias)]
|
2019-07-04 10:05:50 -04:00
|
|
|
#![feature(transparent_unions)]
|
2020-09-03 17:11:02 -07:00
|
|
|
#![feature(try_blocks)]
|
2015-01-06 09:24:46 -08:00
|
|
|
#![feature(unboxed_closures)]
|
2020-11-19 15:01:48 -05:00
|
|
|
#![feature(unsized_fn_params)]
|
2023-05-06 23:43:33 +00:00
|
|
|
#![feature(with_negative_coherence)]
|
2023-04-13 00:36:40 -07:00
|
|
|
// tidy-alphabetical-end
|
2021-08-04 18:24:57 +02:00
|
|
|
//
|
2021-08-04 17:54:07 +02:00
|
|
|
// Target features:
|
2023-04-13 00:36:40 -07:00
|
|
|
// tidy-alphabetical-start
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(arm_target_feature)]
|
2018-12-17 12:06:06 -08:00
|
|
|
#![feature(avx512_target_feature)]
|
2018-08-10 12:01:18 -05:00
|
|
|
#![feature(hexagon_target_feature)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(mips_target_feature)]
|
|
|
|
#![feature(powerpc_target_feature)]
|
2022-10-11 22:42:25 +08:00
|
|
|
#![feature(riscv_target_feature)]
|
2021-08-04 17:54:07 +02:00
|
|
|
#![feature(rtm_target_feature)]
|
|
|
|
#![feature(sse4a_target_feature)]
|
|
|
|
#![feature(tbm_target_feature)]
|
|
|
|
#![feature(wasm_target_feature)]
|
2023-04-13 00:36:40 -07:00
|
|
|
// tidy-alphabetical-end
|
2018-04-03 11:11:49 -07:00
|
|
|
|
2021-04-30 14:54:18 +00:00
|
|
|
// allow using `core::` in intra-doc links
|
|
|
|
#[allow(unused_extern_crates)]
|
|
|
|
extern crate self as core;
|
|
|
|
|
2016-08-22 10:02:28 +00:00
|
|
|
#[prelude_import]
|
|
|
|
#[allow(unused)]
|
|
|
|
use prelude::v1::*;
|
2014-05-01 18:06:59 -07:00
|
|
|
|
2019-10-30 20:59:15 +01:00
|
|
|
#[cfg(not(test))] // See #65860
|
2015-01-06 09:24:46 -08:00
|
|
|
#[macro_use]
|
2014-05-01 10:47:18 -07:00
|
|
|
mod macros;
|
|
|
|
|
2021-07-07 16:25:46 +00:00
|
|
|
// We don't export this through #[macro_export] for now, to avoid breakage.
|
|
|
|
// See https://github.com/rust-lang/rust/issues/82913
|
|
|
|
#[cfg(not(test))]
|
|
|
|
#[unstable(feature = "assert_matches", issue = "82775")]
|
|
|
|
/// Unstable module containing the unstable `assert_matches` macro.
|
2021-07-16 09:18:14 -07:00
|
|
|
pub mod assert_matches {
|
2021-07-07 16:25:46 +00:00
|
|
|
#[unstable(feature = "assert_matches", issue = "82775")]
|
|
|
|
pub use crate::macros::{assert_matches, debug_assert_matches};
|
|
|
|
}
|
|
|
|
|
2023-10-25 09:42:56 -03:00
|
|
|
#[unstable(feature = "cfg_match", issue = "115585")]
|
|
|
|
pub use crate::macros::cfg_match;
|
|
|
|
|
2016-10-23 14:27:49 +01:00
|
|
|
#[macro_use]
|
|
|
|
mod internal_macros;
|
|
|
|
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/int_macros.rs"]
|
2015-01-06 09:24:46 -08:00
|
|
|
#[macro_use]
|
2014-12-18 20:09:57 -08:00
|
|
|
mod int_macros;
|
|
|
|
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "i128_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/i128.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod i128;
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "i16_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/i16.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod i16;
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "i32_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/i32.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod i32;
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "i64_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/i64.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod i64;
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "i8_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/i8.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod i8;
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "isize_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/isize.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod isize;
|
2016-08-23 03:56:52 +03:00
|
|
|
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "u128_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/u128.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod u128;
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "u16_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/u16.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod u16;
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "u32_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/u32.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod u32;
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "u64_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/u64.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod u64;
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "u8_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/u8.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod u8;
|
2024-02-20 13:34:07 -07:00
|
|
|
#[rustc_diagnostic_item = "usize_legacy_mod"]
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/usize.rs"]
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod usize;
|
2016-08-23 03:56:52 +03:00
|
|
|
|
2019-12-22 17:42:04 -05:00
|
|
|
#[path = "num/f32.rs"]
|
|
|
|
pub mod f32;
|
|
|
|
#[path = "num/f64.rs"]
|
|
|
|
pub mod f64;
|
2014-04-30 22:23:26 -07:00
|
|
|
|
2015-04-17 23:45:55 -07:00
|
|
|
#[macro_use]
|
2014-04-30 22:14:22 -07:00
|
|
|
pub mod num;
|
|
|
|
|
2022-10-28 16:48:00 -07:00
|
|
|
/* The core prelude, not as all-encompassing as the std prelude */
|
2014-05-01 18:06:59 -07:00
|
|
|
|
|
|
|
pub mod prelude;
|
|
|
|
|
2014-04-30 20:04:56 -07:00
|
|
|
/* Core modules for ownership management */
|
|
|
|
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod hint;
|
2014-04-30 20:04:56 -07:00
|
|
|
pub mod intrinsics;
|
2014-04-30 20:13:05 -07:00
|
|
|
pub mod mem;
|
2014-04-30 20:17:50 -07:00
|
|
|
pub mod ptr;
|
2024-03-17 10:12:25 +01:00
|
|
|
mod ub_checks;
|
2014-04-30 20:22:55 -07:00
|
|
|
|
|
|
|
/* Core language traits */
|
|
|
|
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod borrow;
|
|
|
|
pub mod clone;
|
2014-06-28 13:57:36 -07:00
|
|
|
pub mod cmp;
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod convert;
|
2014-04-30 20:46:51 -07:00
|
|
|
pub mod default;
|
2022-07-29 18:54:47 +00:00
|
|
|
pub mod error;
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod marker;
|
|
|
|
pub mod ops;
|
2014-04-30 20:33:08 -07:00
|
|
|
|
|
|
|
/* Core types and methods on primitives */
|
|
|
|
|
2014-04-30 20:36:58 -07:00
|
|
|
pub mod any;
|
2015-02-27 22:48:51 +03:00
|
|
|
pub mod array;
|
2018-03-04 13:44:43 -05:00
|
|
|
pub mod ascii;
|
2022-05-22 07:18:32 -03:00
|
|
|
pub mod asserting;
|
2022-02-03 17:56:10 +08:00
|
|
|
#[unstable(feature = "async_iterator", issue = "79024")]
|
|
|
|
pub mod async_iter;
|
2014-05-01 11:19:56 -07:00
|
|
|
pub mod cell;
|
|
|
|
pub mod char;
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod ffi;
|
2023-11-08 09:12:01 +09:00
|
|
|
#[unstable(feature = "core_io_borrowed_buf", issue = "117693")]
|
|
|
|
pub mod io;
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod iter;
|
2022-11-10 21:48:41 +01:00
|
|
|
pub mod net;
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod option;
|
2018-01-23 16:31:53 +01:00
|
|
|
pub mod panic;
|
2014-10-09 15:17:22 -04:00
|
|
|
pub mod panicking;
|
2018-08-09 18:20:22 +03:00
|
|
|
pub mod pin;
|
2014-04-30 23:25:35 -07:00
|
|
|
pub mod result;
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod sync;
|
2015-07-13 11:57:46 -07:00
|
|
|
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod fmt;
|
2014-12-12 18:43:07 -08:00
|
|
|
pub mod hash;
|
2019-12-22 17:42:04 -05:00
|
|
|
pub mod slice;
|
|
|
|
pub mod str;
|
2017-12-11 13:42:01 -05:00
|
|
|
pub mod time;
|
2014-04-30 23:19:52 -07:00
|
|
|
|
2018-04-05 17:09:28 +02:00
|
|
|
pub mod unicode;
|
|
|
|
|
2018-05-30 18:23:10 -07:00
|
|
|
/* Async */
|
|
|
|
pub mod future;
|
|
|
|
pub mod task;
|
|
|
|
|
2018-03-28 22:37:37 +02:00
|
|
|
/* Heap memory allocator trait */
|
|
|
|
#[allow(missing_docs)]
|
2018-04-03 14:41:15 +02:00
|
|
|
pub mod alloc;
|
|
|
|
|
2014-10-31 05:41:25 -04:00
|
|
|
// note: does not need to be public
|
2019-09-07 17:04:19 +01:00
|
|
|
mod bool;
|
2022-11-29 21:02:11 +01:00
|
|
|
mod escape;
|
2014-12-18 19:13:32 -08:00
|
|
|
mod tuple;
|
2017-10-18 23:12:37 -07:00
|
|
|
mod unit;
|
2018-02-17 17:23:19 -08:00
|
|
|
|
2020-02-23 23:59:39 -08:00
|
|
|
#[stable(feature = "core_primitive", since = "1.43.0")]
|
2019-12-26 12:55:13 -05:00
|
|
|
pub mod primitive;
|
|
|
|
|
2022-10-28 16:48:00 -07:00
|
|
|
// Pull in the `core_arch` crate directly into core. The contents of
|
2019-07-15 13:53:44 +02:00
|
|
|
// `core_arch` are in a different repository: rust-lang/stdarch.
|
2019-01-21 18:42:04 +01:00
|
|
|
//
|
2022-10-28 16:48:00 -07:00
|
|
|
// `core_arch` depends on core, but the contents of this module are
|
2019-01-21 18:42:04 +01:00
|
|
|
// set up in such a way that directly pulling it here works such that the
|
2022-10-28 16:48:00 -07:00
|
|
|
// crate uses the this crate as its core.
|
2020-06-11 21:31:49 -05:00
|
|
|
#[path = "../../stdarch/crates/core_arch/src/mod.rs"]
|
2020-06-30 19:10:22 +02:00
|
|
|
#[allow(
|
|
|
|
missing_docs,
|
|
|
|
missing_debug_implementations,
|
|
|
|
dead_code,
|
|
|
|
unused_imports,
|
2023-07-28 22:24:28 +08:00
|
|
|
unsafe_op_in_unsafe_fn,
|
2023-10-03 22:27:25 -04:00
|
|
|
ambiguous_glob_reexports,
|
|
|
|
deprecated_in_future
|
2020-06-30 19:10:22 +02:00
|
|
|
)]
|
2021-05-06 13:36:07 +02:00
|
|
|
#[allow(rustdoc::bare_urls)]
|
2019-01-21 18:42:04 +01:00
|
|
|
mod core_arch;
|
2018-02-17 17:23:19 -08:00
|
|
|
|
2018-04-03 11:11:49 -07:00
|
|
|
#[stable(feature = "simd_arch", since = "1.27.0")]
|
2022-11-20 10:27:38 +01:00
|
|
|
pub mod arch;
|
2021-07-05 22:50:26 -04:00
|
|
|
|
2022-10-28 16:48:00 -07:00
|
|
|
// Pull in the `core_simd` crate directly into core. The contents of
|
2021-10-22 00:12:00 -07:00
|
|
|
// `core_simd` are in a different repository: rust-lang/portable-simd.
|
|
|
|
//
|
2022-10-28 16:48:00 -07:00
|
|
|
// `core_simd` depends on core, but the contents of this module are
|
2021-10-22 00:12:00 -07:00
|
|
|
// set up in such a way that directly pulling it here works such that the
|
2022-10-28 16:48:00 -07:00
|
|
|
// crate uses this crate as its core.
|
2021-10-22 00:12:00 -07:00
|
|
|
#[path = "../../portable-simd/crates/core_simd/src/mod.rs"]
|
2023-06-16 14:00:30 -04:00
|
|
|
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn)]
|
2021-10-22 00:12:00 -07:00
|
|
|
#[allow(rustdoc::bare_urls)]
|
|
|
|
#[unstable(feature = "portable_simd", issue = "86656")]
|
|
|
|
mod core_simd;
|
|
|
|
|
|
|
|
#[unstable(feature = "portable_simd", issue = "86656")]
|
|
|
|
pub mod simd {
|
2023-11-19 13:08:53 -05:00
|
|
|
#![doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")]
|
|
|
|
|
2021-10-22 00:12:00 -07:00
|
|
|
#[unstable(feature = "portable_simd", issue = "86656")]
|
|
|
|
pub use crate::core_simd::simd::*;
|
|
|
|
}
|
|
|
|
|
2021-07-05 22:50:26 -04:00
|
|
|
include!("primitive_docs.rs");
|