Skip to content

Commit 01d7f32

Browse files
committed
Add a rule for std injection in edition 2018
I do not know how this was missing, I've looked at it a million times. I feel like I was maybe missing something, but I really can't find anything that directly refers to this, nor can I find any open issues. I believe this is now done with this relatively subtle bit: https://github.com/rust-lang/rust/blob/4d08223c054cf5a56d9761ca925fd46ffebe7115/compiler/rustc_builtin_macros/src/standard_library_imports.rs#L42 In the past it used to use a different approach of emulating `extern crate std as _;`: https://github.com/rust-lang/rust/blob/c8cf9f5a025bb475804b5a90f54aca310b952526/src/libsyntax_ext/standard_library_imports.rs#L42-L46
1 parent 068b94d commit 01d7f32

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/names/preludes.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,10 @@ By default, the [`std`] crate is injected into the [extern prelude], and all mac
109109
110110
If the `no_std` attribute is specified, then the [`core`] crate is used instead of `std`, and similarly all macros exported from `core` are placed into the [`macro_use` prelude].
111111
112+
r[names.preludes.extern.no_std.edition2018]
113+
> [!EDITION-2018]
114+
> Before the 2018 edition, `std` is also injected into the crate root. `core` is injected instead of `std` if `no_std` is specified. Starting with the 2018 edition, these are not injected into the crate root.
115+
112116
r[names.preludes.lang]
113117
## Language prelude
114118

0 commit comments

Comments
 (0)