core/prelude/
common.rs

1//! Items common to the prelude of all editions.
2//!
3//! See the [module-level documentation](super) for more.
4
5// No formatting: this file is nothing but re-exports, and their order is worth preserving.
6#![cfg_attr(rustfmt, rustfmt::skip)]
7
8// Re-exported core operators
9#[stable(feature = "core_prelude", since = "1.4.0")]
10#[doc(no_inline)]
11pub use crate::marker::{Copy, Send, Sized, Sync, Unpin};
12#[stable(feature = "core_prelude", since = "1.4.0")]
13#[doc(no_inline)]
14pub use crate::ops::{Drop, Fn, FnMut, FnOnce};
15#[stable(feature = "async_closure", since = "1.85.0")]
16#[doc(no_inline)]
17pub use crate::ops::{AsyncFn, AsyncFnMut, AsyncFnOnce};
18
19// Re-exported functions
20#[stable(feature = "core_prelude", since = "1.4.0")]
21#[doc(no_inline)]
22pub use crate::mem::drop;
23#[stable(feature = "size_of_prelude", since = "1.80.0")]
24#[doc(no_inline)]
25pub use crate::mem::{align_of, align_of_val, size_of, size_of_val};
26
27// Re-exported types and traits
28#[stable(feature = "core_prelude", since = "1.4.0")]
29#[doc(no_inline)]
30pub use crate::clone::Clone;
31#[stable(feature = "core_prelude", since = "1.4.0")]
32#[doc(no_inline)]
33pub use crate::cmp::{Eq, Ord, PartialEq, PartialOrd};
34#[stable(feature = "core_prelude", since = "1.4.0")]
35#[doc(no_inline)]
36pub use crate::convert::{AsMut, AsRef, From, Into};
37#[stable(feature = "core_prelude", since = "1.4.0")]
38#[doc(no_inline)]
39pub use crate::default::Default;
40#[stable(feature = "core_prelude", since = "1.4.0")]
41#[doc(no_inline)]
42pub use crate::iter::{DoubleEndedIterator, ExactSizeIterator, Extend, IntoIterator, Iterator};
43#[stable(feature = "core_prelude", since = "1.4.0")]
44#[doc(no_inline)]
45pub use crate::option::Option::{self, None, Some};
46#[stable(feature = "core_prelude", since = "1.4.0")]
47#[doc(no_inline)]
48pub use crate::result::Result::{self, Err, Ok};
49
50// Re-exported built-in macros
51#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
52#[doc(no_inline)]
53pub use crate::fmt::macros::Debug;
54#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
55#[doc(no_inline)]
56pub use crate::hash::macros::Hash;
57
58#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
59#[allow(deprecated)]
60#[doc(no_inline)]
61pub use crate::{
62    assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
63    format_args_nl, include, include_bytes, include_str, line, log_syntax, module_path, option_env,
64    stringify, trace_macros,
65};
66
67#[unstable(
68    feature = "concat_bytes",
69    issue = "87555",
70    reason = "`concat_bytes` is not stable enough for use and is subject to change"
71)]
72#[doc(no_inline)]
73pub use crate::concat_bytes;
74
75// Do not `doc(no_inline)` so that they become doc items on their own
76// (no public module for them to be re-exported from).
77#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
78pub use crate::macros::builtin::{
79    alloc_error_handler, bench, derive, global_allocator, test, test_case,
80};
81
82#[unstable(feature = "derive_const", issue = "none")]
83pub use crate::macros::builtin::derive_const;
84
85#[unstable(
86    feature = "cfg_accessible",
87    issue = "64797",
88    reason = "`cfg_accessible` is not fully implemented"
89)]
90pub use crate::macros::builtin::cfg_accessible;
91
92#[unstable(
93    feature = "cfg_eval",
94    issue = "82679",
95    reason = "`cfg_eval` is a recently implemented feature"
96)]
97pub use crate::macros::builtin::cfg_eval;
98
99#[unstable(
100    feature = "type_ascription",
101    issue = "23416",
102    reason = "placeholder syntax for type ascription"
103)]
104pub use crate::macros::builtin::type_ascribe;
105
106#[unstable(
107    feature = "deref_patterns",
108    issue = "87121",
109    reason = "placeholder syntax for deref patterns"
110)]
111pub use crate::macros::builtin::deref;