@@ -59,13 +59,21 @@ alloc/test limitation.
59
59
60
60
### The `no_std ` attribute
61
61
62
+ By default , the standard library is automatically included in the crate root
63
+ module . The [`std `] crate is added to the root , along with an implicit
64
+ [`macro_use ` attribute ] pulling in all macros exported from `std ` into the
65
+ [`macro_use ` prelude ]. Both [`core `] and [`std `] are added to the [extern
66
+ prelude ]. The [standard library prelude ] includes everything from the
67
+ [`std :: prelude :: v1 `] module .
68
+
62
69
The * `no_std ` [attribute ]* may be applied at the crate level to prevent the
63
70
[`std `] crate from being automatically added into scope . It does three things :
64
71
65
72
* Prevents `std ` from being added to the [extern prelude ](#extern - prelude ).
66
73
* Uses [`core :: prelude :: v1 `] in the [standard library prelude ] instead of
67
74
[`std :: prelude :: v1 `].
68
- * Injects the [`core `] crate into the crate root instead of `std `.
75
+ * Injects the [`core `] crate into the crate root instead of [`std `], and pulls
76
+ in all macros exported from `core ` in the [`macro_use ` prelude ].
69
77
70
78
> * * Note ** : Using the core prelude over the standard prelude is useful when
71
79
> either the crate is targeting a platform that does not support the standard
@@ -112,7 +120,12 @@ on a module to indicate that it should not automatically bring the [standard
112
120
library prelude], [extern prelude], or [tool prelude] into scope for that
113
121
module or any of its descendants.
114
122
115
- This attribute does not affect the [language prelude] or [`macro_use` prelude].
123
+ This attribute does not affect the [language prelude].
124
+
125
+ > * * Edition Differences** : In the 2015 edition, the `no_implicit_prelude`
126
+ > attribute does not affect the [`macro_use` prelude], and all macros exported
127
+ > from the standard library are still included in the `macro_use` prelude.
128
+ > Starting in the 2018 edition, it will remove the `macro_use` prelude.
116
129
117
130
[`alloc`]: .. / .. / alloc/ index. html
118
131
[`Box`]: .. / .. / std/ boxed/ struct . Box. html
0 commit comments