std/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 = "rust1", since = "1.0.0")]
10#[doc(no_inline)]
11pub use crate::marker::{Send, Sized, Sync, Unpin};
12#[stable(feature = "rust1", since = "1.0.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 = "rust1", since = "1.0.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 = "rust1", since = "1.0.0")]
29#[doc(no_inline)]
30pub use crate::convert::{AsMut, AsRef, From, Into};
31#[stable(feature = "rust1", since = "1.0.0")]
32#[doc(no_inline)]
33pub use crate::iter::{DoubleEndedIterator, ExactSizeIterator};
34#[stable(feature = "rust1", since = "1.0.0")]
35#[doc(no_inline)]
36pub use crate::iter::{Extend, IntoIterator, Iterator};
37#[stable(feature = "rust1", since = "1.0.0")]
38#[doc(no_inline)]
39pub use crate::option::Option::{self, None, Some};
40#[stable(feature = "rust1", since = "1.0.0")]
41#[doc(no_inline)]
42pub use crate::result::Result::{self, Err, Ok};
43
44// Re-exported built-in macros
45#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
46#[allow(deprecated)]
47#[doc(no_inline)]
48pub use core::prelude::v1::{
49    assert, cfg, column, compile_error, concat, concat_idents, env, file, format_args,
50    format_args_nl, include, include_bytes, include_str, line, log_syntax, module_path, option_env,
51    stringify, trace_macros, Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd,
52};
53
54#[unstable(
55    feature = "concat_bytes",
56    issue = "87555",
57    reason = "`concat_bytes` is not stable enough for use and is subject to change"
58)]
59#[doc(no_inline)]
60pub use core::prelude::v1::concat_bytes;
61
62// Do not `doc(no_inline)` so that they become doc items on their own
63// (no public module for them to be re-exported from).
64#[stable(feature = "builtin_macro_prelude", since = "1.38.0")]
65pub use core::prelude::v1::{
66    alloc_error_handler, bench, derive, global_allocator, test, test_case,
67};
68
69#[unstable(feature = "derive_const", issue = "none")]
70pub use core::prelude::v1::derive_const;
71
72// Do not `doc(no_inline)` either.
73#[unstable(
74    feature = "cfg_accessible",
75    issue = "64797",
76    reason = "`cfg_accessible` is not fully implemented"
77)]
78pub use core::prelude::v1::cfg_accessible;
79
80// Do not `doc(no_inline)` either.
81#[unstable(
82    feature = "cfg_eval",
83    issue = "82679",
84    reason = "`cfg_eval` is a recently implemented feature"
85)]
86pub use core::prelude::v1::cfg_eval;
87
88// Do not `doc(no_inline)` either.
89#[unstable(
90    feature = "type_ascription",
91    issue = "23416",
92    reason = "placeholder syntax for type ascription"
93)]
94pub use core::prelude::v1::type_ascribe;
95
96// Do not `doc(no_inline)` either.
97#[unstable(
98    feature = "deref_patterns",
99    issue = "87121",
100    reason = "placeholder syntax for deref patterns"
101)]
102pub use core::prelude::v1::deref;
103
104// The file so far is equivalent to core/src/prelude/v1.rs. It is duplicated
105// rather than glob imported because we want docs to show these re-exports as
106// pointing to within `std`.
107// Below are the items from the alloc crate.
108
109#[stable(feature = "rust1", since = "1.0.0")]
110#[doc(no_inline)]
111pub use crate::borrow::ToOwned;
112#[stable(feature = "rust1", since = "1.0.0")]
113#[doc(no_inline)]
114pub use crate::boxed::Box;
115#[stable(feature = "rust1", since = "1.0.0")]
116#[doc(no_inline)]
117pub use crate::string::{String, ToString};
118#[stable(feature = "rust1", since = "1.0.0")]
119#[doc(no_inline)]
120pub use crate::vec::Vec;