Skip to content

Commit 4f50d52

Browse files
ehusstraviscross
authored andcommitted
Move note and warning to the intro
These don't really belong where they are, and are just generally helpful things about the attribute.
1 parent dea61cb commit 4f50d52

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/names/preludes.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,12 @@ By default, the standard library is automatically included in the crate root mod
8888
> #![no_std]
8989
> ```
9090
91+
> [!NOTE]
92+
> Using `no_std` is useful when either the crate is targeting a platform that does not support the standard library or is purposefully not using the capabilities of the standard library. Those capabilities are mainly dynamic memory allocation (e.g. `Box` and `Vec`) and file and network capabilities (e.g. `std::fs` and `std::io`).
93+
94+
> [!WARNING]
95+
> Using `no_std` does not prevent the standard library from being linked in. It is still valid to put `extern crate std;` into the crate and dependencies can also link it in.
96+
9197
r[names.preludes.extern.no_std.syntax]
9298
The `no_std` attribute uses the [MetaWord] syntax and thus does not take any inputs.
9399
@@ -103,11 +109,7 @@ r[names.preludes.extern.no_std.module]
103109
r[names.preludes.extern.no_std.core]
104110
* Injects the [`core`] crate into the crate root instead of [`std`], and pulls in all macros exported from `core` in the [`macro_use` prelude].
105111
106-
> [!NOTE]
107-
> Using the core prelude over the standard prelude is useful when either the crate is targeting a platform that does not support the standard library or is purposefully not using the capabilities of the standard library. Those capabilities are mainly dynamic memory allocation (e.g. `Box` and `Vec`) and file and network capabilities (e.g. `std::fs` and `std::io`).
108112
109-
> [!WARNING]
110-
> Using `no_std` does not prevent the standard library from being linked in. It is still valid to put `extern crate std;` into the crate and dependencies can also link it in.
111113
112114
r[names.preludes.lang]
113115
## Language prelude

0 commit comments

Comments
 (0)