]> git.lizzy.rs Git - rust.git/blob - library/rustc-std-workspace-core/README.md
Rollup merge of #97264 - TaKO8Ki:suggest-extern-crate-when-failing-to-resolve-use...
[rust.git] / library / rustc-std-workspace-core / README.md
1 # The `rustc-std-workspace-core` crate
2
3 This crate is a shim and empty crate which simply depends on `libcore` and
4 reexports all of its contents. The crate is the crux of empowering the standard
5 library to depend on crates from crates.io
6
7 Crates on crates.io that the standard library depend on need to depend on the
8 `rustc-std-workspace-core` crate from crates.io, which is empty. We use
9 `[patch]` to override it to this crate in this repository. As a result, crates
10 on crates.io will draw a dependency edge to `libcore`, the version defined in
11 this repository. That should draw all the dependency edges to ensure Cargo
12 builds crates successfully!
13
14 Note that crates on crates.io need to depend on this crate with the name `core`
15 for everything to work correctly. To do that they can use:
16
17 ```toml
18 core = { version = "1.0.0", optional = true, package = 'rustc-std-workspace-core' }
19 ```
20
21 Through the use of the `package` key the crate is renamed to `core`, meaning
22 it'll look like
23
24 ```
25 --extern core=.../librustc_std_workspace_core-XXXXXXX.rlib
26 ```
27
28 when Cargo invokes the compiler, satisfying the implicit `extern crate core`
29 directive injected by the compiler.