v1.rs - source
Description: Source of the Rust file `library/core/src/prelude/v1.rs`.

#
core/prelude/
v1.rs

    1//! The first version of the core prelude.
    2//!
    3//! See the [module-level documentation](super) for more.
    4
    5#![stable(feature = "core_prelude", since = "1.4.0")]
    6
    7// No formatting: this file is nothing but re-exports, and their order is worth preserving.
    8#![cfg_attr(rustfmt, rustfmt::skip)]
    9
    10// Re-exported core operators
    11#[stable(feature = "core_prelude", since = "1.4.0")]
    12#[doc(no_inline)]
    13pub use crate::marker::{Copy, Send, Sized, Sync, Unpin};
    14#[stable(feature = "core_prelude", since = "1.4.0")]
    15#[doc(no_inline)]
    16pub use crate::ops::{Drop, Fn, FnMut, FnOnce};
    17#[stable(feature = "async_closure", since = "1.85.0")]
    18#[doc(no_inline)]
    19pub use crate::ops::{AsyncFn, AsyncFnMut, AsyncFnOnce};
    20
    21// Re-exported functions
    22#[stable(feature = "core_prelude", since = "1.4.0")]
    23#[doc(no_inline)]
    24pub use crate::mem::drop;
    25#[stable(feature = "size_of_prelude", since = "1.80.0")]
    26#[doc(no_inline)]
    27pub use crate::mem::{align_of, align_of_val, size_of, size_of_val};
    28
    29// Re-exported types and traits
    30#[stable(feature = "core_prelude", since = "1.4.0")]
    31#[doc(no_inline)]
    32pub use crate::clone::Clone;
    33#[stable(feature = "core_prelude", since = "1.4.0")]
    34#[doc(no_inline)]
    35pub use crate::cmp::{Eq, Ord, PartialEq, PartialOrd};
    36#[stable(feature = "core_prelude", since = "1.4.0")]
    37#[doc(no_inline)]
    38pub use crate::convert::{AsMut, AsRef, From, Into};
    39#[stable(feature = "core_prelude", since = "1.4.0")]
    40#[doc(no_inline)]
    41pub use crate::default::Default;
    42#[stable(feature = "core_prelude", since = "1.4.0")]
    43#[doc(no_inline)]
    44pub use crate::iter::{DoubleEndedIterator, ExactSizeIterator, Extend, IntoIterator, Iterator};
    45#[stable(feature = "core_prelude", since = "1.4.0")]
    46#[doc(no_inline)]
    47pub use crate::option::Option::{self, None, Some};
    48#[stable(feature = "core_prelude", since = "1.4.0")]
    49#[doc(no_inline)]
    50pub use crate::result::Result::{self, Err, Ok};
    51
    52// Re-exported built-in macros
    53#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
    54#[doc(no_inline)]
    55pub use crate::fmt::macros::Debug;
    56#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
    57#[doc(no_inline)]
    58pub use crate::hash::macros::Hash;
    59
    60#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
    61#[doc(no_inline)]
    62#[expect(deprecated)]
    63pub use crate::{
    64    assert, assert_eq, assert_ne, cfg, column, compile_error, concat, debug_assert, debug_assert_eq,
    65    debug_assert_ne, file, format_args, include, include_bytes, include_str, line, matches,
    66    module_path, option_env, stringify, todo, r#try, unimplemented, unreachable, write, writeln,
    67};
    68
    69// These macros need special handling, so that we don't export them *and* the modules of the same
    70// name. We only want the macros in the prelude so we shadow the original modules with private
    71// modules with the same names.
    72mod ambiguous_macros_only {
    73    mod env {}
    74    #[expect(hidden_glob_reexports)]
    75    mod panic {}
    76    #[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
    77    pub use crate::*;
    78}
    79#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
    80#[doc(no_inline)]
    81pub use self::ambiguous_macros_only::{env, panic};
    82
    83#[unstable(feature = "cfg_select", issue = "115585")]
    84#[doc(no_inline)]
    85pub use crate::cfg_select;
    86
    87#[unstable(
    88    feature = "concat_bytes",
    89    issue = "87555",
    90    reason = "`concat_bytes` is not stable enough for use and is subject to change"
    91)]
    92#[doc(no_inline)]
    93pub use crate::concat_bytes;
    94
    95#[unstable(feature = "const_format_args", issue = "none")]
    96#[doc(no_inline)]
    97pub use crate::const_format_args;
    98
    99#[unstable(
    100    feature = "log_syntax",
    101    issue = "29598",
    102    reason = "`log_syntax!` is not stable enough for use and is subject to change"
    103)]
    104#[doc(no_inline)]
    105pub use crate::log_syntax;
    106
    107#[unstable(feature = "pattern_type_macro", issue = "123646")]
    108#[doc(no_inline)]
    109pub use crate::pattern_type;
    110
    111#[unstable(
    112    feature = "trace_macros",
    113    issue = "29598",
    114    reason = "`trace_macros` is not stable enough for use and is subject to change"
    115)]
    116#[doc(no_inline)]
    117pub use crate::trace_macros;
    118
    119// Do not `doc(no_inline)` so that they become doc items on their own
    120// (no public module for them to be re-exported from).
    121#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
    122pub use crate::macros::builtin::{
    123    alloc_error_handler, bench, derive, global_allocator, test, test_case,
    124};
    125
    126#[unstable(feature = "derive_const", issue = "118304")]
    127pub use crate::macros::builtin::derive_const;
    128
    129#[unstable(
    130    feature = "cfg_accessible",
    131    issue = "64797",
    132    reason = "`cfg_accessible` is not fully implemented"
    133)]
    134pub use crate::macros::builtin::cfg_accessible;
    135
    136#[unstable(
    137    feature = "cfg_eval",
    138    issue = "82679",
    139    reason = "`cfg_eval` is a recently implemented feature"
    140)]
    141pub use crate::macros::builtin::cfg_eval;
    142
    143#[unstable(
    144    feature = "type_ascription",
    145    issue = "23416",
    146    reason = "placeholder syntax for type ascription"
    147)]
    148pub use crate::macros::builtin::type_ascribe;
    149
    150#[unstable(
    151    feature = "deref_patterns",
    152    issue = "87121",
    153    reason = "placeholder syntax for deref patterns"
    154)]
    155pub use crate::macros::builtin::deref;
    156
    157#[unstable(
    158    feature = "type_alias_impl_trait",
    159    issue = "63063",
    160    reason = "`type_alias_impl_trait` has open design concerns"
    161)]
    162pub use crate::macros::builtin::define_opaque;
    163
    164#[unstable(feature = "extern_item_impls", issue = "125418")]
    165pub use crate::macros::builtin::{eii, unsafe_eii};
    166
    167#[unstable(feature = "eii_internals", issue = "none")]
    168pub use crate::macros::builtin::eii_declaration;