Skip to content

Commit 0ec21f0

Browse files
committed
Fix note about sysroot crates and extern prelude.
1 parent fc251f9 commit 0ec21f0

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/items/extern-crates.md

+5-12
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,14 @@ prelude lookups within that module.
5959
> Beginning in the 2018 edition, [use declarations] can reference crates in
6060
> the extern prelude, so it is considered unidiomatic to use `extern crate`.
6161
62-
> **Note**: Crates not explicitly named with the `--extern` flag with `rustc`
63-
> are not included in the extern prelude. As a result, additional crates
64-
> that ship with `rustc`, such as [`proc_macro`], [`alloc`], and [`test`],
65-
> currently aren't available in the extern prelude and must be brought into
66-
> scope with an `extern crate` declaration, even in the 2018 edition. `use`
67-
> paths must reference the `extern crate` item (such as using [`crate::`] or
68-
> [`self::`] path prefixes).
62+
> **Note**: Additional crates that ship with `rustc`, such as [`proc_macro`],
63+
> [`alloc`], and [`test`], are not automatically included with the `--extern`
64+
> flag when using Cargo. They must be brought into scope with an `extern
65+
> crate` declaration, even in the 2018 edition.
6966
>
7067
> ```rust
7168
> extern crate proc_macro;
72-
> // Cannot reference `proc_macro` directly because it is not in the extern prelude.
73-
> // use proc_macro::TokenStream;
74-
> // Instead, you must reference the item in scope from the `extern crate`
75-
> // declaration.
76-
> use self::proc_macro::TokenStream;
69+
> use proc_macro::TokenStream;
7770
> ```
7871
7972
<!--

0 commit comments

Comments
 (0)