Skip to main content

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