2014-05-22 16:44:54 +00:00
|
|
|
//! # The Rust Core Library
|
2014-05-13 04:22:35 +00:00
|
|
|
//!
|
2015-11-05 13:33:30 +00:00
|
|
|
//! The Rust Core Library is the dependency-free[^free] foundation of [The
|
2014-05-20 04:53:00 +00: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 18:39:40 +00:00
|
|
|
//! upstream libraries, no system libraries, and no libc.
|
2014-05-20 04:53:00 +00:00
|
|
|
//!
|
2015-11-05 13:33:30 +00:00
|
|
|
//! [^free]: Strictly speaking, there are some symbols which are needed but
|
2015-11-18 10:35:29 +00:00
|
|
|
//! they aren't always necessary.
|
2015-11-05 13:33:30 +00:00
|
|
|
//!
|
2014-05-20 04:53:00 +00: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 18:39:40 +00:00
|
|
|
//! platform integration, and this library is platform-agnostic.
|
2014-05-20 04:53:00 +00:00
|
|
|
//!
|
|
|
|
//! # How to use the core library
|
|
|
|
//!
|
2016-07-15 17:17:35 +00:00
|
|
|
//! Please note that all of these details are currently not considered stable.
|
|
|
|
//!
|
2014-05-20 17:40:14 +00:00
|
|
|
// FIXME: Fill me in with more detail when the interface settles
|
2014-05-20 04:53:00 +00:00
|
|
|
//! This library is built on the assumption of a few existing symbols:
|
2014-05-13 04:22:35 +00:00
|
|
|
//!
|
2022-02-16 11:23:37 +00:00
|
|
|
//! * `memcpy`, `memcmp`, `memset`, `strlen` - These are core memory routines which are
|
2014-05-13 04:22:35 +00:00
|
|
|
//! often generated by LLVM. Additionally, this library can make explicit
|
2014-05-19 15:51:16 +00:00
|
|
|
//! calls to these functions. Their signatures are the same as found in C.
|
2014-05-14 18:24:12 +00:00
|
|
|
//! These functions are often provided by the system libc, but can also be
|
2019-01-02 07:18:13 +00:00
|
|
|
//! provided by the [compiler-builtins crate](https://crates.io/crates/compiler_builtins).
|
2014-05-13 04:22:35 +00:00
|
|
|
//!
|
2017-06-28 00:41:24 +00: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 17:17:35 +00:00
|
|
|
//! dictate the panic message, the file at which panic was invoked, and the
|
2017-06-27 02:26:52 +00: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 08:57:11 +00:00
|
|
|
//! return. This requires a `lang` attribute named `panic_impl`.
|
2016-08-14 11:33:53 +00: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 20:57:36 +00:00
|
|
|
|
2022-10-28 23:48:00 +00:00
|
|
|
// Since core defines many fundamental lang items, all tests live in a
|
2022-11-03 22:59:23 +00:00
|
|
|
// separate crate, libcoretest (library/core/tests), to avoid bizarre issues.
|
2018-05-05 19:29:19 +00: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 23:48:00 +00: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-05 19:29:19 +00:00
|
|
|
// discussion in #50466 for details.
|
|
|
|
//
|
|
|
|
// This cfg won't affect doc tests.
|
2018-05-05 17:02:05 +00:00
|
|
|
#![cfg(not(test))]
|
2022-10-28 23:48:00 +00:00
|
|
|
// To run core tests without x.py without ending up with two copies of core, Miri needs to be
|
2021-07-18 15:21:59 +00:00
|
|
|
// able to "empty" this crate. See <https://github.com/rust-lang/miri-test-libstd/issues/4>.
|
|
|
|
// rustc itself never sets the feature, so this line has no affect there.
|
|
|
|
#![cfg(any(not(feature = "miri-test-libstd"), test, doctest))]
|
2015-12-03 01:31:49 +00:00
|
|
|
#![stable(feature = "core", since = "1.6.0")]
|
2019-02-05 13:37:15 +00:00
|
|
|
#![doc(
|
2015-08-16 15:22:50 +00:00
|
|
|
html_playground_url = "https://play.rust-lang.org/",
|
2015-12-03 01:31:49 +00:00
|
|
|
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)))
|
|
|
|
)]
|
2022-01-14 08:50:49 +00: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 21:31:23 +00:00
|
|
|
#![no_core]
|
2022-04-05 20:42:23 +00:00
|
|
|
#![rustc_coherence_is_core]
|
2021-08-04 16:24:57 +00:00
|
|
|
//
|
2021-08-04 15:54:07 +00:00
|
|
|
// Lints:
|
|
|
|
#![deny(rust_2021_incompatible_or_patterns)]
|
|
|
|
#![deny(unsafe_op_in_unsafe_fn)]
|
2022-11-20 10:28:08 +00:00
|
|
|
#![deny(fuzzy_provenance_casts)]
|
2018-12-21 10:08:26 +00:00
|
|
|
#![warn(deprecated_in_future)]
|
2019-01-28 09:49:11 +00:00
|
|
|
#![warn(missing_debug_implementations)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![warn(missing_docs)]
|
2019-04-15 02:23:21 +00:00
|
|
|
#![allow(explicit_outlives_requirements)]
|
2022-08-18 19:39:14 +00:00
|
|
|
#![allow(incomplete_features)]
|
2022-12-09 02:27:03 +00:00
|
|
|
#![cfg_attr(not(bootstrap), warn(multiple_supertrait_upcastable))]
|
2021-08-04 16:24:57 +00:00
|
|
|
//
|
2022-03-07 21:36:13 +00:00
|
|
|
// Library features:
|
2021-11-05 12:39:01 +00:00
|
|
|
#![feature(const_align_offset)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(const_align_of_val)]
|
2022-09-23 19:14:34 +00:00
|
|
|
#![feature(const_align_of_val_raw)]
|
|
|
|
#![feature(const_alloc_layout)]
|
2021-07-06 12:38:26 +00:00
|
|
|
#![feature(const_arguments_as_str)]
|
2021-12-06 09:12:59 +00:00
|
|
|
#![feature(const_array_into_iter_constructors)]
|
2021-05-07 02:14:57 +00:00
|
|
|
#![feature(const_bigint_helper_methods)]
|
2021-12-23 11:07:41 +00:00
|
|
|
#![feature(const_black_box)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(const_caller_location)]
|
2020-11-04 10:41:57 +00:00
|
|
|
#![feature(const_cell_into_inner)]
|
2022-09-29 12:23:47 +00:00
|
|
|
#![feature(const_char_from_u32_unchecked)]
|
2021-12-11 19:19:23 +00:00
|
|
|
#![feature(const_clone)]
|
2021-12-29 06:07:54 +00:00
|
|
|
#![feature(const_cmp)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(const_discriminant)]
|
2021-10-19 05:37:25 +00:00
|
|
|
#![feature(const_eval_select)]
|
2022-10-07 18:57:34 +00:00
|
|
|
#![feature(const_exact_div)]
|
2020-08-22 19:24:35 +00:00
|
|
|
#![feature(const_float_bits_conv)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(const_float_classify)]
|
2021-10-25 16:07:16 +00:00
|
|
|
#![feature(const_fmt_arguments_new)]
|
2022-11-06 16:46:38 +00:00
|
|
|
#![feature(const_hash)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(const_heap)]
|
2021-12-05 10:46:29 +00:00
|
|
|
#![feature(const_convert)]
|
2022-06-04 23:23:15 +00:00
|
|
|
#![feature(const_index_range_slice_index)]
|
2021-05-09 00:18:44 +00:00
|
|
|
#![feature(const_inherent_unchecked_arith)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(const_int_unchecked_arith)]
|
|
|
|
#![feature(const_intrinsic_forget)]
|
|
|
|
#![feature(const_likely)]
|
2022-04-16 00:53:50 +00:00
|
|
|
#![feature(const_maybe_uninit_uninit_array)]
|
2021-11-14 05:36:19 +00:00
|
|
|
#![feature(const_maybe_uninit_as_mut_ptr)]
|
2022-03-31 19:04:14 +00:00
|
|
|
#![feature(const_maybe_uninit_assume_init)]
|
2022-04-13 13:50:23 +00:00
|
|
|
#![feature(const_nonnull_new)]
|
2021-10-20 03:04:58 +00:00
|
|
|
#![feature(const_num_from_num)]
|
2021-10-21 21:03:18 +00:00
|
|
|
#![feature(const_ops)]
|
2020-07-01 13:07:23 +00:00
|
|
|
#![feature(const_option)]
|
2021-12-14 17:58:01 +00:00
|
|
|
#![feature(const_option_ext)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(const_pin)]
|
2022-10-07 20:24:31 +00:00
|
|
|
#![feature(const_pointer_is_aligned)]
|
2022-04-10 23:02:52 +00:00
|
|
|
#![feature(const_ptr_sub_ptr)]
|
2021-07-02 21:34:52 +00:00
|
|
|
#![feature(const_replace)]
|
2022-10-24 00:02:50 +00:00
|
|
|
#![feature(const_result_drop)]
|
2022-04-13 13:50:23 +00:00
|
|
|
#![feature(const_ptr_as_ref)]
|
2021-12-11 19:27:43 +00:00
|
|
|
#![feature(const_ptr_is_null)]
|
2020-12-26 00:27:13 +00:00
|
|
|
#![feature(const_ptr_read)]
|
2021-01-18 21:59:56 +00:00
|
|
|
#![feature(const_ptr_write)]
|
2020-07-16 13:12:59 +00:00
|
|
|
#![feature(const_raw_ptr_comparison)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(const_size_of_val)]
|
2022-09-23 19:14:34 +00:00
|
|
|
#![feature(const_size_of_val_raw)]
|
2022-05-29 16:01:26 +00:00
|
|
|
#![feature(const_slice_from_raw_parts_mut)]
|
2020-05-06 05:43:18 +00:00
|
|
|
#![feature(const_slice_ptr_len)]
|
2022-09-14 14:54:49 +00:00
|
|
|
#![feature(const_slice_split_at_mut)]
|
2021-11-05 12:39:01 +00:00
|
|
|
#![feature(const_str_from_utf8_unchecked_mut)]
|
2021-03-13 19:33:27 +00:00
|
|
|
#![feature(const_swap)]
|
2020-12-27 18:46:01 +00:00
|
|
|
#![feature(const_trait_impl)]
|
2022-09-10 07:44:56 +00:00
|
|
|
#![feature(const_try)]
|
2020-09-22 22:39:19 +00:00
|
|
|
#![feature(const_type_id)]
|
2019-12-18 17:00:59 +00:00
|
|
|
#![feature(const_type_name)]
|
2021-08-14 16:35:12 +00:00
|
|
|
#![feature(const_default_impls)]
|
2022-09-03 03:52:28 +00:00
|
|
|
#![feature(const_unicode_case_lookup)]
|
2022-03-29 17:30:55 +00:00
|
|
|
#![feature(const_unsafecell_get_mut)]
|
2022-09-14 12:15:44 +00:00
|
|
|
#![feature(const_waker)]
|
2021-12-21 09:39:00 +00:00
|
|
|
#![feature(core_panic)]
|
2022-04-04 13:04:58 +00:00
|
|
|
#![feature(char_indices_offset)]
|
2021-10-05 03:09:23 +00:00
|
|
|
#![feature(duration_consts_float)]
|
2021-12-06 09:12:59 +00:00
|
|
|
#![feature(maybe_uninit_uninit_array)]
|
2022-09-21 20:43:21 +00:00
|
|
|
#![feature(ptr_alignment_type)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(ptr_metadata)]
|
2022-10-28 19:06:29 +00:00
|
|
|
#![feature(set_ptr_value)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(slice_ptr_get)]
|
2022-08-25 10:54:30 +00:00
|
|
|
#![feature(slice_split_at_unchecked)]
|
2021-11-05 12:39:01 +00:00
|
|
|
#![feature(str_internals)]
|
2022-04-04 13:04:58 +00:00
|
|
|
#![feature(str_split_remainder)]
|
|
|
|
#![feature(str_split_inclusive_remainder)]
|
2022-11-20 10:28:08 +00:00
|
|
|
#![feature(strict_provenance)]
|
2022-03-07 21:36:13 +00:00
|
|
|
#![feature(utf16_extra)]
|
|
|
|
#![feature(utf16_extra_const)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(variant_count)]
|
2021-10-22 08:15:56 +00:00
|
|
|
#![feature(const_array_from_ref)]
|
|
|
|
#![feature(const_slice_from_ref)]
|
2022-03-06 03:00:12 +00:00
|
|
|
#![feature(const_slice_index)]
|
|
|
|
#![feature(const_is_char_boundary)]
|
2022-08-08 23:20:15 +00:00
|
|
|
#![feature(const_cstr_methods)]
|
2022-09-27 06:25:13 +00:00
|
|
|
#![feature(is_ascii_octdigit)]
|
2021-08-04 16:24:57 +00:00
|
|
|
//
|
2021-08-04 15:54:07 +00:00
|
|
|
// Language features:
|
|
|
|
#![feature(abi_unadjusted)]
|
2022-08-18 19:39:14 +00:00
|
|
|
#![feature(adt_const_params)]
|
2021-08-05 16:58:52 +00:00
|
|
|
#![feature(allow_internal_unsafe)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(allow_internal_unstable)]
|
|
|
|
#![feature(associated_type_bounds)]
|
|
|
|
#![feature(auto_traits)]
|
2022-09-01 05:14:40 +00:00
|
|
|
#![feature(c_unwind)]
|
2022-07-12 13:41:47 +00:00
|
|
|
#![feature(cfg_sanitize)]
|
2022-02-16 02:40:07 +00:00
|
|
|
#![feature(cfg_target_has_atomic)]
|
2022-02-23 13:06:22 +00:00
|
|
|
#![feature(cfg_target_has_atomic_equal_alignment)]
|
2023-01-25 14:48:32 +00:00
|
|
|
#![feature(const_closures)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(const_fn_floating_point_arithmetic)]
|
|
|
|
#![feature(const_mut_refs)]
|
|
|
|
#![feature(const_precise_live_drops)]
|
|
|
|
#![feature(const_refs_to_cell)]
|
2019-06-29 14:51:20 +00:00
|
|
|
#![feature(decl_macro)]
|
2022-04-05 20:42:23 +00:00
|
|
|
#![feature(deprecated_suggestion)]
|
2022-12-15 08:52:32 +00:00
|
|
|
#![feature(derive_const)]
|
2018-03-09 19:31:04 +00:00
|
|
|
#![feature(doc_cfg)]
|
2021-05-06 11:36:07 +00:00
|
|
|
#![feature(doc_notable_trait)]
|
2021-11-30 15:50:44 +00:00
|
|
|
#![feature(rustdoc_internals)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(exhaustive_patterns)]
|
2021-10-19 07:27:59 +00:00
|
|
|
#![feature(doc_cfg_hide)]
|
2018-04-02 09:26:16 +00:00
|
|
|
#![feature(extern_types)]
|
2015-08-11 21:31:23 +00:00
|
|
|
#![feature(fundamental)]
|
2021-08-16 15:29:49 +00:00
|
|
|
#![feature(if_let_guard)]
|
2022-10-20 04:30:00 +00:00
|
|
|
#![feature(inline_const)]
|
2020-12-19 13:23:59 +00:00
|
|
|
#![feature(intra_doc_pointers)]
|
2015-06-09 18:18:03 +00:00
|
|
|
#![feature(intrinsics)]
|
|
|
|
#![feature(lang_items)]
|
2018-02-18 01:23:19 +00:00
|
|
|
#![feature(link_llvm_intrinsics)]
|
2022-04-07 11:13:41 +00:00
|
|
|
#![feature(macro_metavar_expr)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(min_specialization)]
|
2021-10-19 07:27:59 +00:00
|
|
|
#![feature(must_not_suspend)]
|
2020-04-22 19:45:35 +00:00
|
|
|
#![feature(negative_impls)]
|
2019-12-11 14:55:29 +00:00
|
|
|
#![feature(never_type)]
|
2015-08-11 21:31:23 +00:00
|
|
|
#![feature(no_core)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(no_coverage)] // rust-lang/rust#84605
|
|
|
|
#![feature(platform_intrinsics)]
|
2017-03-17 14:05:44 +00:00
|
|
|
#![feature(prelude_import)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(repr_simd)]
|
|
|
|
#![feature(rustc_allow_const_fn_unstable)]
|
2016-03-10 19:20:09 +00:00
|
|
|
#![feature(rustc_attrs)]
|
2018-02-18 01:23:19 +00:00
|
|
|
#![feature(simd_ffi)]
|
2015-01-30 20:26:44 +00:00
|
|
|
#![feature(staged_api)]
|
2018-02-18 01:23:19 +00:00
|
|
|
#![feature(stmt_expr_attributes)]
|
2022-10-11 14:42:25 +00:00
|
|
|
#![feature(target_feature_11)]
|
2020-10-19 13:38:11 +00:00
|
|
|
#![feature(trait_alias)]
|
2019-07-04 14:05:50 +00:00
|
|
|
#![feature(transparent_unions)]
|
2020-09-04 00:11:02 +00:00
|
|
|
#![feature(try_blocks)]
|
2015-01-06 17:24:46 +00:00
|
|
|
#![feature(unboxed_closures)]
|
2020-11-19 20:01:48 +00:00
|
|
|
#![feature(unsized_fn_params)]
|
2021-11-30 15:50:44 +00:00
|
|
|
#![feature(asm_const)]
|
2022-10-16 21:53:51 +00:00
|
|
|
#![feature(const_transmute_copy)]
|
2022-12-09 02:27:03 +00:00
|
|
|
#![cfg_attr(not(bootstrap), feature(multiple_supertrait_upcastable))]
|
2021-08-04 16:24:57 +00:00
|
|
|
//
|
2021-08-04 15:54:07 +00:00
|
|
|
// Target features:
|
|
|
|
#![feature(arm_target_feature)]
|
2018-12-17 20:06:06 +00:00
|
|
|
#![feature(avx512_target_feature)]
|
2019-01-19 23:25:06 +00:00
|
|
|
#![feature(cmpxchg16b_target_feature)]
|
2018-08-10 17:01:18 +00:00
|
|
|
#![feature(hexagon_target_feature)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(mips_target_feature)]
|
|
|
|
#![feature(powerpc_target_feature)]
|
2022-10-11 14:42:25 +00:00
|
|
|
#![feature(riscv_target_feature)]
|
2021-08-04 15:54:07 +00:00
|
|
|
#![feature(rtm_target_feature)]
|
|
|
|
#![feature(sse4a_target_feature)]
|
|
|
|
#![feature(tbm_target_feature)]
|
|
|
|
#![feature(wasm_target_feature)]
|
2018-04-03 18:11:49 +00: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-02 01:06:59 +00:00
|
|
|
|
2019-10-30 19:59:15 +00:00
|
|
|
#[cfg(not(test))] // See #65860
|
2015-01-06 17:24:46 +00:00
|
|
|
#[macro_use]
|
2014-05-01 17:47:18 +00: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 16:18:14 +00: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};
|
|
|
|
}
|
|
|
|
|
2016-10-23 13:27:49 +00:00
|
|
|
#[macro_use]
|
|
|
|
mod internal_macros;
|
|
|
|
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/int_macros.rs"]
|
2015-01-06 17:24:46 +00:00
|
|
|
#[macro_use]
|
2014-12-19 04:09:57 +00:00
|
|
|
mod int_macros;
|
|
|
|
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/i128.rs"]
|
2016-06-26 13:23:44 +00:00
|
|
|
pub mod i128;
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/i16.rs"]
|
2016-06-26 13:23:44 +00:00
|
|
|
pub mod i16;
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/i32.rs"]
|
2016-06-26 13:23:44 +00:00
|
|
|
pub mod i32;
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/i64.rs"]
|
2016-06-26 13:23:44 +00:00
|
|
|
pub mod i64;
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/i8.rs"]
|
2016-06-26 13:23:44 +00:00
|
|
|
pub mod i8;
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/isize.rs"]
|
2018-05-27 08:53:43 +00:00
|
|
|
pub mod isize;
|
2016-08-23 00:56:52 +00:00
|
|
|
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/u128.rs"]
|
2015-01-07 18:39:37 +00:00
|
|
|
pub mod u128;
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/u16.rs"]
|
2016-06-26 13:23:44 +00:00
|
|
|
pub mod u16;
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/u32.rs"]
|
2016-06-26 13:23:44 +00:00
|
|
|
pub mod u32;
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/u64.rs"]
|
2016-06-26 13:23:44 +00:00
|
|
|
pub mod u64;
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/u8.rs"]
|
2016-06-26 13:23:44 +00:00
|
|
|
pub mod u8;
|
2020-09-04 14:00:38 +00:00
|
|
|
#[path = "num/shells/usize.rs"]
|
2018-05-27 08:53:43 +00:00
|
|
|
pub mod usize;
|
2016-08-23 00:56:52 +00:00
|
|
|
|
2014-05-01 05:23:26 +00:00
|
|
|
#[path = "num/f32.rs"]
|
|
|
|
pub mod f32;
|
|
|
|
#[path = "num/f64.rs"]
|
|
|
|
pub mod f64;
|
|
|
|
|
2015-04-18 06:45:55 +00:00
|
|
|
#[macro_use]
|
2014-05-01 05:14:22 +00:00
|
|
|
pub mod num;
|
|
|
|
|
2022-10-28 23:48:00 +00:00
|
|
|
/* The core prelude, not as all-encompassing as the std prelude */
|
2014-05-02 01:06:59 +00:00
|
|
|
|
|
|
|
pub mod prelude;
|
|
|
|
|
2014-05-01 03:04:56 +00:00
|
|
|
/* Core modules for ownership management */
|
|
|
|
|
2018-04-12 13:47:38 +00:00
|
|
|
pub mod hint;
|
2014-05-01 03:04:56 +00:00
|
|
|
pub mod intrinsics;
|
2014-05-01 03:13:05 +00:00
|
|
|
pub mod mem;
|
2014-05-01 03:17:50 +00:00
|
|
|
pub mod ptr;
|
2014-05-01 03:22:55 +00:00
|
|
|
|
|
|
|
/* Core language traits */
|
|
|
|
|
2015-08-19 14:03:59 +00:00
|
|
|
pub mod borrow;
|
2014-06-28 20:57:36 +00:00
|
|
|
pub mod clone;
|
|
|
|
pub mod cmp;
|
2014-05-01 03:55:38 +00:00
|
|
|
pub mod convert;
|
2014-05-01 03:46:51 +00:00
|
|
|
pub mod default;
|
2022-07-29 18:54:47 +00:00
|
|
|
pub mod error;
|
2015-03-18 16:14:54 +00:00
|
|
|
pub mod marker;
|
2015-08-19 14:03:59 +00:00
|
|
|
pub mod ops;
|
2014-05-01 03:33:08 +00:00
|
|
|
|
|
|
|
/* Core types and methods on primitives */
|
|
|
|
|
2014-05-01 03:36:58 +00:00
|
|
|
pub mod any;
|
2015-02-27 19:48:51 +00:00
|
|
|
pub mod array;
|
2018-03-04 18:44:43 +00:00
|
|
|
pub mod ascii;
|
2022-05-22 10:18:32 +00:00
|
|
|
pub mod asserting;
|
2022-02-03 09:56:10 +00:00
|
|
|
#[unstable(feature = "async_iterator", issue = "79024")]
|
|
|
|
pub mod async_iter;
|
2014-05-01 18:19:56 +00:00
|
|
|
pub mod cell;
|
|
|
|
pub mod char;
|
2018-09-02 21:06:32 +00:00
|
|
|
pub mod ffi;
|
2014-05-01 04:41:03 +00:00
|
|
|
pub mod iter;
|
2014-05-01 04:35:56 +00:00
|
|
|
pub mod option;
|
2018-01-23 15:31:53 +00:00
|
|
|
pub mod panic;
|
2014-10-09 19:17:22 +00:00
|
|
|
pub mod panicking;
|
2018-08-09 15:20:22 +00:00
|
|
|
pub mod pin;
|
2014-05-01 06:25:35 +00:00
|
|
|
pub mod result;
|
2018-09-02 21:06:32 +00:00
|
|
|
pub mod sync;
|
2015-07-13 18:57:46 +00:00
|
|
|
|
2014-05-01 06:06:36 +00:00
|
|
|
pub mod fmt;
|
2014-12-13 02:43:07 +00:00
|
|
|
pub mod hash;
|
2014-05-01 05:54:25 +00:00
|
|
|
pub mod slice;
|
core: Inherit the std::fmt module
This commit moves all possible functionality from the standard library's string
formatting utilities into the core library. This is a breaking change, due to a
few tweaks in the semantics of formatting:
1. In order to break the dependency on the std::io module, a new trait,
FormatWriter was introduced in core::fmt. This is the trait which is used
(instead of Writer) to format data into a stream.
2. The new FormatWriter trait has one method, write(), which takes some bytes
and can return an error, but the error contains very little information. The
intent for this trait is for an adaptor writer to be used around the standard
library's Writer trait.
3. The fmt::write{,ln,_unsafe} methods no longer take &mut io::Writer, but
rather &mut FormatWriter. Since this trait is less common, all functions were
removed except fmt::write, and it is not intended to be invoked directly.
The main API-breaking change here is that the fmt::Formatter structure will no
longer expose its `buf` field. All previous code writing directly to `f.buf`
using writer methods or the `write!` macro will now instead use `f` directly.
The Formatter object itself implements the `Writer` trait itself for
convenience, although it does not implement the `FormatWriter` trait. The
fallout of these changes will be in the following commits.
[breaking-change]
2014-05-10 20:33:43 +00:00
|
|
|
pub mod str;
|
2017-12-11 18:42:01 +00:00
|
|
|
pub mod time;
|
2014-05-01 06:19:52 +00:00
|
|
|
|
2018-04-05 15:09:28 +00:00
|
|
|
pub mod unicode;
|
|
|
|
|
2018-05-31 01:23:10 +00:00
|
|
|
/* Async */
|
|
|
|
pub mod future;
|
|
|
|
pub mod task;
|
|
|
|
|
2018-03-28 20:37:37 +00:00
|
|
|
/* Heap memory allocator trait */
|
|
|
|
#[allow(missing_docs)]
|
2018-04-03 12:41:15 +00:00
|
|
|
pub mod alloc;
|
|
|
|
|
2014-10-31 09:41:25 +00:00
|
|
|
// note: does not need to be public
|
2019-09-07 16:04:19 +00:00
|
|
|
mod bool;
|
2014-12-19 03:13:32 +00:00
|
|
|
mod tuple;
|
2017-10-19 06:12:37 +00:00
|
|
|
mod unit;
|
2018-02-18 01:23:19 +00:00
|
|
|
|
2020-02-24 07:59:39 +00:00
|
|
|
#[stable(feature = "core_primitive", since = "1.43.0")]
|
2019-12-26 17:55:13 +00:00
|
|
|
pub mod primitive;
|
|
|
|
|
2022-10-28 23:48:00 +00:00
|
|
|
// Pull in the `core_arch` crate directly into core. The contents of
|
2019-07-15 11:53:44 +00:00
|
|
|
// `core_arch` are in a different repository: rust-lang/stdarch.
|
2019-01-21 17:42:04 +00:00
|
|
|
//
|
2022-10-28 23:48:00 +00:00
|
|
|
// `core_arch` depends on core, but the contents of this module are
|
2019-01-21 17:42:04 +00:00
|
|
|
// set up in such a way that directly pulling it here works such that the
|
2022-10-28 23:48:00 +00:00
|
|
|
// crate uses the this crate as its core.
|
2020-06-12 02:31:49 +00:00
|
|
|
#[path = "../../stdarch/crates/core_arch/src/mod.rs"]
|
2020-06-30 17:10:22 +00:00
|
|
|
#[allow(
|
|
|
|
missing_docs,
|
|
|
|
missing_debug_implementations,
|
|
|
|
dead_code,
|
|
|
|
unused_imports,
|
|
|
|
unsafe_op_in_unsafe_fn
|
|
|
|
)]
|
2021-05-06 11:36:07 +00:00
|
|
|
#[allow(rustdoc::bare_urls)]
|
2020-06-28 00:11:04 +00:00
|
|
|
// FIXME: This annotation should be moved into rust-lang/stdarch after clashing_extern_declarations is
|
2020-06-19 08:14:54 +00:00
|
|
|
// merged. It currently cannot because bootstrap fails as the lint hasn't been defined yet.
|
2020-07-16 13:12:59 +00:00
|
|
|
#[allow(clashing_extern_declarations)]
|
2018-02-18 01:23:19 +00:00
|
|
|
#[unstable(feature = "stdsimd", issue = "48556")]
|
2019-01-21 17:42:04 +00:00
|
|
|
mod core_arch;
|
2018-02-18 01:23:19 +00:00
|
|
|
|
2018-04-03 18:11:49 +00:00
|
|
|
#[stable(feature = "simd_arch", since = "1.27.0")]
|
2022-11-20 09:27:38 +00:00
|
|
|
pub mod arch;
|
2021-07-06 02:50:26 +00:00
|
|
|
|
2022-10-28 23:48:00 +00:00
|
|
|
// Pull in the `core_simd` crate directly into core. The contents of
|
2021-10-22 07:12:00 +00:00
|
|
|
// `core_simd` are in a different repository: rust-lang/portable-simd.
|
|
|
|
//
|
2022-10-28 23:48:00 +00:00
|
|
|
// `core_simd` depends on core, but the contents of this module are
|
2021-10-22 07:12:00 +00:00
|
|
|
// set up in such a way that directly pulling it here works such that the
|
2022-10-28 23:48:00 +00:00
|
|
|
// crate uses this crate as its core.
|
2021-10-22 07:12:00 +00:00
|
|
|
#[path = "../../portable-simd/crates/core_simd/src/mod.rs"]
|
|
|
|
#[allow(missing_debug_implementations, dead_code, unsafe_op_in_unsafe_fn, unused_unsafe)]
|
|
|
|
#[allow(rustdoc::bare_urls)]
|
|
|
|
#[unstable(feature = "portable_simd", issue = "86656")]
|
|
|
|
mod core_simd;
|
|
|
|
|
|
|
|
#[doc = include_str!("../../portable-simd/crates/core_simd/src/core_simd_docs.md")]
|
|
|
|
#[unstable(feature = "portable_simd", issue = "86656")]
|
|
|
|
pub mod simd {
|
|
|
|
#[unstable(feature = "portable_simd", issue = "86656")]
|
|
|
|
pub use crate::core_simd::simd::*;
|
|
|
|
}
|
|
|
|
|
2021-07-06 02:50:26 +00:00
|
|
|
include!("primitive_docs.rs");
|