Skip to content

Commit bfdd6c9

Browse files
adamgemmelldavidtwco
authored andcommitted
1a: clarify built crates
1 parent 30e15a9 commit bfdd6c9

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

text/0000-build-std/4-stage-1a.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ will not be used unless explicitly set and the crate graph's dependencies on the
5757
standard library will determine which crates are built instead. Otherwise,
5858
`build-std-crate` will default to "std".
5959

60+
If `std` is to be built and Cargo is building a test using the default test
61+
harness then Cargo will also build the `test` crate.
62+
6063
> [!NOTE]
6164
>
6265
> Inspired by the concept of [opaque dependencies][Opaque dependencies], the
@@ -74,18 +77,17 @@ standard library will determine which crates are built instead. Otherwise,
7477
> - The profile defined by the standard library will be used.
7578
>
7679
> Cargo will resolves the dependencies of opaque dependencies, such as the
77-
> standard library, separately in their own workspaces. The "roots" of such a
78-
> resolve are defined as the unified set of packages that any crate in the
79-
> dependency graph has a explicit dependency on and those which Cargo infers a
80-
> direct dependency on. A dependency on the roots are added to all crates in the
81-
> "parent" resolve.
80+
> standard library, separately in their own workspaces. The root of such a
81+
> resolve will be the crate specified in `build-std-crates`, or, if stage 1b is
82+
> implemented, the unified set of packages that any crate in the dependency has
83+
> a direct dependency on. A dependency on the relevant roots are added to all
84+
> crates in the "parent" resolve.
8285
>
8386
> Regardless of which standard library crates are being built, Cargo will build
8487
> the `sysroot` crate of the standard library workspace. `alloc` and `std` will
8588
> be optional dependencies of the `sysroot` crate which will be enabled when the
86-
> user has requested them. The sysroot always depends on the `proc_macro` and
87-
> `test` crates. Panic runtimes are dependencies of `std` and will be enabled
88-
> depending on the features that Cargo passes to `std` (see
89+
> user has requested them. Panic runtimes are dependencies of `std` and will be
90+
> enabled depending on the features that Cargo passes to `std` (see
8991
> [*Panic strategies*][panic-strategies]).
9092
>
9193
> rustc loads panic runtimes in a different way to most dependencies, and
@@ -680,9 +682,10 @@ which further limits potential use cases to those without `target-modifiers`.
680682
[rationale-replace-no_std]: #why-not-replace-no_std-as-the-source-of-truth-for-whether-a-crate-depends-on-std
681683

682684
Crates can currently use the crate attribute `#![no_std]` to indicate a lack of
683-
dependency on `std`. With `Cargo.toml` being used to express a dependency on the
684-
standard library (or lack thereof), it is unintuitive for there to be two
685-
sources-of-truth for this information.
685+
dependency on `std`. With `build-std-crates` or explicit dependencies (as in
686+
[Stage 1b][stage1b]) allowing the user to specify a dependency on the standard
687+
library, it is unintuitive for there to be two sources-of-truth for this
688+
information.
686689

687690
`#![no_std]` serves two purposes - it stops the compiler from loading `std` from
688691
the sysroot and adding `extern crate std`, and it prevents the user from

0 commit comments

Comments
 (0)