@@ -15,9 +15,9 @@ different crates to require different standard library crates.
1515RFCs:**
1616
17171 . build-std context ([ rfcs #3873 ] )
18- - [ Background] [ background ]
19- - [ History] [ history ]
20- - [ Motivation] [ motivation ]
18+ - [ Background] [ rfcs#3873- background]
19+ - [ History] [ rfcs#3873- history]
20+ - [ Motivation] [ rfcs#3873- motivation]
21212 . ` build-std="always" ` ([ rfcs #3874 ] )
2222 - [ Proposal] [ rfcs#3874-proposal ]
2323 - [ Rationale and alternatives] [ rfcs#3874-rationale-and-alternatives ]
@@ -31,13 +31,27 @@ RFCs:**
31314 . ` build-std="compatible" ` (RFC not opened yet)
32325 . ` build-std="match-profile" ` (RFC not opened yet)
3333
34+ [ build-std project goal ] : https://rust-lang.github.io/rust-project-goals/2025h2/build-std.html
35+
36+ [ rfcs#3873 ] : https://github.com/rust-lang/rfcs/pull/3873
37+ [ rfcs#3873-proposal ] : https://github.com/davidtwco/rfcs/blob/build-std-part-one-context/text/3873-build-std-context.md#proposal
38+ [ rfcs#3873-background ] : https://github.com/davidtwco/rfcs/blob/build-std-part-one-context/text/3873-build-std-context.md#background
39+ [ rfcs#3873-history ] : https://github.com/davidtwco/rfcs/blob/build-std-part-one-context/text/3873-build-std-context.md#history
40+ [ rfcs#3873-motivation ] : https://github.com/davidtwco/rfcs/blob/build-std-part-one-context/text/3873-build-std-context.md#motivation
41+ [ rfcs#3873-dependencies ] : https://github.com/davidtwco/rfcs/blob/build-std-part-one-context/text/3873-build-std-context.md#dependencies
42+
43+ [ rfcs#3874 ] : https://github.com/rust-lang/rfcs/pull/3874
44+ [ rfcs#3874-proposal ] : https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#proposal
45+ [ rfcs#3874-rationale-and-alternatives ] : https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#rationale-and-alternatives
46+ [ rfcs#3874-unresolved-questions ] : https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#unresolved-questions
47+ [ rfcs#3874-future-possibilities ] : https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#future-possibilities
48+
3449# Motivation
3550[ motivation ] : #motivation
3651
3752This RFC builds on a large collection of prior art collated in the
38- [ ` build-std-context ` ] [ build-std-context ] RFC. It does not directly address the
39- main [ motivations] it identifies but supports
40- later proposals.
53+ [ ` build-std-context ` ] [ rfcs#3873-proposal ] RFC. It does not directly address the
54+ main [ rfcs #3873 -motivation] it identifies but supports later proposals.
4155
4256The main motivation for this proposal is to support future extensions to
4357build-std which allow public/private standard library dependencies or enabling
@@ -85,14 +99,16 @@ Cargo feature.
8599
86100Crates without an explicit dependency on the standard library now have a
87101implicit dependency ([ ?] [ rationale-no-migration ] ) on that target's default set
88- of standard library crates (see [ build-std-always] [ standard-library-crate-stability ] ).
89- Any explicit ` builtin ` dependency present in any dependency table will disable
90- the implicit dependencies.
102+ of standard library crates (see
103+ [ build-std-always] [ rfcs#3874-standard-library-crate-stability ] ). Any explicit
104+ ` builtin ` dependency present in any dependency table will disable the implicit
105+ dependencies.
91106
92107> [ !NOTE]
93108>
94109> Implicit dependencies are passed to rustc with the ` noprelude ` modifier to
95- > ensure backwards compatibility as in [ ` build-std=always ` ] [ always-noprelude ] .
110+ > ensure backwards compatibility as in
111+ > [ ` build-std=always ` ] [ rfcs#3874-noprelude ] .
96112
97113When a ` std ` dependency is present an additional implicit dependency on the
98114` test ` crate is added for crates that are being tested with the default test
@@ -216,6 +232,9 @@ files ([?][rationale-cargo-lock]).
216232- [*Allow `builtin` source replacement*][future-source-replacement]
217233- [*Remove `rustc_dep_of_std`*][future-rustc_dep_of_std]
218234
235+ [rfcs#3874-standard-library-crate-stability ]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#standard-library-crate-stability
236+ [rfcs#3874-noprelude ]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#why-use-noprelude-with---extern
237+
219238# # Non-`builtin` standard library dependencies
220239[non-builtin-standard-library-dependencies ]: # non-builtin-standard-library-dependencies
221240
@@ -356,8 +375,8 @@ implicit dependencies. It is possible for `dev-dependencies` to have additional
356375requiring ` std ` when the regular dependencies only require ` core ` ).
357376
358377Build scripts and proc macros continue to use the pre-built standard library as
359- in [ ` build-std=always ` ] [ always ] , and so explicit dependencies on the standard
360- library are not supported in ` build-dependencies ` .
378+ in [ ` build-std=always ` ] [ rfcs#3874-proposal ] , and so explicit dependencies on the
379+ standard library are not supported in ` build-dependencies ` .
361380
362381* See the following sections for relevant unresolved questions:*
363382
@@ -430,6 +449,8 @@ similarly be updated to support `builtin_deps`.
430449- [*Why add a new key to Cargo's registry index JSON schema?*][rationale-cargo-builtindeps]
431450- [*Why can `builtin_deps` shadow other packages in the registry?*][rationale-cargo-index-shadowing]
432451
452+ [cargo-registry-web-publish ]: https://doc.rust-lang.org/cargo/reference/registry-web-api.html#publish
453+
433454## Cargo subcommands
434455[cargo-subcommands ]: #cargo-subcommands
435456
@@ -612,6 +633,47 @@ This part of the RFC has no implications for the following Cargo subcommands:
612633- [`cargo version`][cargo-version]
613634- [`cargo yank`][cargo-yank]
614635
636+ [cargo-pkgid-spec]: https://doc.rust-lang.org/cargo/reference/pkgid-spec.html
637+
638+ [cargo-add]: https://doc.rust-lang.org/cargo/commands/cargo-add.html
639+ [cargo-bench]: https://doc.rust-lang.org/cargo/commands/cargo-bench.html
640+ [cargo-build]: https://doc.rust-lang.org/cargo/commands/cargo-build.html
641+ [cargo-check]: https://doc.rust-lang.org/cargo/commands/cargo-check.html
642+ [cargo-clean]: https://doc.rust-lang.org/cargo/commands/cargo-clean.html
643+ [cargo-clippy]: https://doc.rust-lang.org/cargo/commands/cargo-clippy.html
644+ [cargo-doc]: https://doc.rust-lang.org/cargo/commands/cargo-doc.html
645+ [cargo-fetch]: https://doc.rust-lang.org/cargo/commands/cargo-fetch.html
646+ [cargo-fix]: https://doc.rust-lang.org/cargo/commands/cargo-fix.html
647+ [cargo-fmt]: https://doc.rust-lang.org/cargo/commands/cargo-fmt.html
648+ [cargo-generate-lockfile]: https://doc.rust-lang.org/cargo/commands/cargo-generate-lockfile.html
649+ [cargo-help]: https://doc.rust-lang.org/cargo/commands/cargo-help.html
650+ [cargo-info]: https://doc.rust-lang.org/cargo/commands/cargo-info.html
651+ [cargo-init]: https://doc.rust-lang.org/cargo/commands/cargo-init.html
652+ [cargo-install]: https://doc.rust-lang.org/cargo/commands/cargo-install.html
653+ [cargo-locate-project]: https://doc.rust-lang.org/cargo/commands/cargo-locate-project.html
654+ [cargo-login]: https://doc.rust-lang.org/cargo/commands/cargo-login.html
655+ [cargo-logout]: https://doc.rust-lang.org/cargo/commands/cargo-login.html
656+ [cargo-metadata]: https://doc.rust-lang.org/cargo/commands/cargo-metadata.html
657+ [cargo-miri]: https://doc.rust-lang.org/cargo/commands/cargo-miri.html
658+ [cargo-new]: https://doc.rust-lang.org/cargo/commands/cargo-new.html
659+ [cargo-owner]: https://doc.rust-lang.org/cargo/commands/cargo-owner.html
660+ [cargo-package]: https://doc.rust-lang.org/cargo/commands/cargo-package.html
661+ [cargo-pkgid]: https://doc.rust-lang.org/cargo/commands/cargo-pkgid.html
662+ [cargo-publish]: https://doc.rust-lang.org/cargo/commands/cargo-publish.html
663+ [cargo-remove]: https://doc.rust-lang.org/cargo/commands/cargo-remove.html
664+ [cargo-report]: https://doc.rust-lang.org/cargo/commands/cargo-report.html
665+ [cargo-run]: https://doc.rust-lang.org/cargo/commands/cargo-run.html
666+ [cargo-rustc]: https://doc.rust-lang.org/cargo/commands/cargo-rustc.html
667+ [cargo-rustdoc]: https://doc.rust-lang.org/cargo/commands/cargo-rustdoc.html
668+ [cargo-search]: https://doc.rust-lang.org/cargo/commands/cargo-search.html
669+ [cargo-test]: https://doc.rust-lang.org/cargo/commands/cargo-test.html
670+ [cargo-tree]: https://doc.rust-lang.org/cargo/commands/cargo-tree.html
671+ [cargo-uninstall]: https://doc.rust-lang.org/cargo/commands/cargo-uninstall.html
672+ [cargo-update]: https://doc.rust-lang.org/cargo/commands/cargo-update.html
673+ [cargo-vendor]: https://doc.rust-lang.org/cargo/commands/cargo-vendor.html
674+ [cargo-version]: https://doc.rust-lang.org/cargo/commands/cargo-version.html
675+ [cargo-yank]: https://doc.rust-lang.org/cargo/commands/cargo-yank.html
676+
615677# Rationale and alternatives
616678[rationale-and-alternatives]: #rationale-and-alternatives
617679
@@ -643,8 +705,8 @@ required:
643705
644706- Cargo could allow the user to specify which crates are required to be built,
645707 such as with the existing options to the `-Zbuild-std=` flag.
646- [`build-std=always`][always ] proposes a `build-std-crates` flag to enable
647- explicit dependencies to be a separate part of this RFC.
708+ [`build-std=always`][rfcs#3874-proposal ] proposes a `build-std-crates` flag to
709+ enable explicit dependencies to be a separate part of this RFC.
648710
649711Furthermore, supporting explicit dependencies on standard library crates enables
650712use of other Cargo features that apply to dependencies in a natural and
@@ -747,7 +809,7 @@ Supporting implicit dependencies allows the majority of the Rust ecosystem from
747809having to make any changes - `no_std` crates (or crates with a `std` feature)
748810will still benefit from adding explicit dependencies as allow them to be easily
749811used with `no_std` targets but users can still work around any legacy crates in
750- the graph with [`build-std-crates`][always ].
812+ the graph with [`build-std-crates`][rfcs#3874-proposal ].
751813
752814↩ [*Proposal*][proposal]
753815
@@ -767,6 +829,9 @@ of the user's names for `builtin` crates.
767829
768830↩ [*Proposal*][proposal]
769831
832+ [cargo-docs-renaming]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml
833+ [rust-extern-prelude]: https://doc.rust-lang.org/reference/names/preludes.html#extern-prelude
834+
770835## Why disallow source replacement on `builtin` packages?
771836[rationale-source-replacement]: #why-disallow-source-replacement-on-builtin-packages
772837
@@ -891,6 +956,9 @@ take today, using `path` dependencies for the standard library to shadow it).
891956
892957↩ [*Registries*][registries]
893958
959+ [cargo-json-schema]: https://doc.rust-lang.org/cargo/reference/registry-index.html#json-schema
960+ [embed-rs-source]: https://github.com/embed-rs/stm32f7-discovery/blob/e2bf713263791c028c2a897f2eb1830d7f09eceb/core/src/lib.rs#L7
961+
894962## Why can `builtin_deps` shadow other packages in the registry?
895963[rationale-cargo-index-shadowing]: #why-can-builtin_deps-shadow-other-packages-in-the-registry
896964
@@ -965,8 +1033,8 @@ would be desirable.
9651033# Prior art
9661034[prior-art]: #prior-art
9671035
968- See the [*Background*][background] and [*History*][history] of the build-std
969- context RFC.
1036+ See the [*Background*][rfcs#3873- background] and [*History*][rfcs#3873- history]
1037+ of the build-std context RFC.
9701038
9711039# Future possibilities
9721040[future-possibilities]: #future-possibilities
@@ -1024,16 +1092,19 @@ allow the standard library to define some features as stable and others as
10241092unstable.
10251093
10261094As there are some features that Cargo will set itself when appropriate (e.g. to
1027- enable or disable [panic runtimes][panic-strategies] or
1028- [`compiler-builtins/mem`][compiler-builtins-mem]), Cargo may need to always
1095+ enable or disable [panic runtimes][rfcs#3874- panic-strategies] or
1096+ [`compiler-builtins/mem`][rfcs#3874- compiler-builtins-mem]), Cargo may need to always
10291097prevent some otherwise stable features from being toggled as it controls those.
10301098
10311099↩ [*Features*][features]
10321100
1101+ [rfcs#3874-panic-strategies]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#panic-strategies
1102+ [rfcs#3874-compiler-builtins-mem]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#compiler-builtinsmem
1103+
10331104## Allow local builds of `compiler-rt` intrinsics
10341105[future-compiler-builtins-c]: #allow-local-builds-of-compiler-rt-intrinsics
10351106
1036- The [`c` feature][background -dependencies] of `compiler_builtins` (which is also
1107+ The [`c` feature][rfcs#3873 -dependencies] of `compiler_builtins` (which is also
10371108exposed by `core`, `alloc` and `std` through `compiler-builtins-c`) causes its
10381109`build.rs` file to build and link in more optimised C versions of intrinsics.
10391110
@@ -1042,70 +1113,4 @@ platform does not have a suitable C compiler available. The user being able to
10421113enable this manually will be enabled through work on features (see
10431114[*Allow enabling/disabling features with build-std*][future-features]). Once the
10441115user can enable `compiler-builtins/c`, they will need to manually configure
1045- `CFLAGS` to ensure that the C components will link with Rust code.
1046-
1047- [build-std project goal]: https://rust-lang.github.io/rust-project-goals/2025h2/build-std.html
1048-
1049- [rfcs#3873]: https://github.com/rust-lang/rfcs/pull/3873
1050- [rfcs#3874]: https://github.com/rust-lang/rfcs/pull/3874
1051- [rfcs#3874-proposal]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#proposal
1052- [rfcs#3874-rationale-and-alternatives]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#rationale-and-alternatives
1053- [rfcs#3874-unresolved-questions]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#unresolved-questions
1054- [rfcs#3874-future-possibilities]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#future-possibilities
1055-
1056- [build-std-context]: https://github.com/davidtwco/rfcs/blob/build-std-part-one-context/text/3873-build-std-context.md
1057- [background]: https://github.com/davidtwco/rfcs/blob/build-std-part-one-context/text/3873-build-std-context.md#background
1058- [history]: https://github.com/davidtwco/rfcs/blob/build-std-part-one-context/text/3873-build-std-context.md#history
1059- [motivations]: https://github.com/davidtwco/rfcs/blob/build-std-part-one-context/text/3873-build-std-context.md#motivation
1060- [background-dependencies]: https://github.com/davidtwco/rfcs/blob/build-std-part-one-context/text/3873-build-std-context.md#dependencies
1061- [always]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#proposal
1062- [standard-library-crate-stability]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#standard-library-crate-stability
1063- [panic-strategies]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#panic-strategies
1064- [compiler-builtins-mem]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#compiler-builtinsmem
1065- [always-noprelude]: https://github.com/davidtwco/rfcs/blob/build-std-part-two-always/text/3874-build-std-always.md#why-use-noprelude-with---extern
1066-
1067- [cargo-docs-renaming]: https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#renaming-dependencies-in-cargotoml
1068- [cargo-json-schema]: https://doc.rust-lang.org/cargo/reference/registry-index.html#json-schema
1069- [cargo-registry-web-publish]: https://doc.rust-lang.org/cargo/reference/registry-web-api.html#publish
1070- [cargo-pkgid-spec]: https://doc.rust-lang.org/cargo/reference/pkgid-spec.html
1071- [embed-rs-source]: https://github.com/embed-rs/stm32f7-discovery/blob/e2bf713263791c028c2a897f2eb1830d7f09eceb/core/src/lib.rs#L7
1072- [rust-extern-prelude]: https://doc.rust-lang.org/reference/names/preludes.html#extern-prelude
1073-
1074- [cargo-add]: https://doc.rust-lang.org/cargo/commands/cargo-add.html
1075- [cargo-bench]: https://doc.rust-lang.org/cargo/commands/cargo-bench.html
1076- [cargo-build]: https://doc.rust-lang.org/cargo/commands/cargo-build.html
1077- [cargo-check]: https://doc.rust-lang.org/cargo/commands/cargo-check.html
1078- [cargo-clean]: https://doc.rust-lang.org/cargo/commands/cargo-clean.html
1079- [cargo-clippy]: https://doc.rust-lang.org/cargo/commands/cargo-clippy.html
1080- [cargo-doc]: https://doc.rust-lang.org/cargo/commands/cargo-doc.html
1081- [cargo-fetch]: https://doc.rust-lang.org/cargo/commands/cargo-fetch.html
1082- [cargo-fix]: https://doc.rust-lang.org/cargo/commands/cargo-fix.html
1083- [cargo-fmt]: https://doc.rust-lang.org/cargo/commands/cargo-fmt.html
1084- [cargo-generate-lockfile]: https://doc.rust-lang.org/cargo/commands/cargo-generate-lockfile.html
1085- [cargo-help]: https://doc.rust-lang.org/cargo/commands/cargo-help.html
1086- [cargo-info]: https://doc.rust-lang.org/cargo/commands/cargo-info.html
1087- [cargo-init]: https://doc.rust-lang.org/cargo/commands/cargo-init.html
1088- [cargo-install]: https://doc.rust-lang.org/cargo/commands/cargo-install.html
1089- [cargo-locate-project]: https://doc.rust-lang.org/cargo/commands/cargo-locate-project.html
1090- [cargo-login]: https://doc.rust-lang.org/cargo/commands/cargo-login.html
1091- [cargo-logout]: https://doc.rust-lang.org/cargo/commands/cargo-login.html
1092- [cargo-metadata]: https://doc.rust-lang.org/cargo/commands/cargo-metadata.html
1093- [cargo-miri]: https://doc.rust-lang.org/cargo/commands/cargo-miri.html
1094- [cargo-new]: https://doc.rust-lang.org/cargo/commands/cargo-new.html
1095- [cargo-owner]: https://doc.rust-lang.org/cargo/commands/cargo-owner.html
1096- [cargo-package]: https://doc.rust-lang.org/cargo/commands/cargo-package.html
1097- [cargo-pkgid]: https://doc.rust-lang.org/cargo/commands/cargo-pkgid.html
1098- [cargo-publish]: https://doc.rust-lang.org/cargo/commands/cargo-publish.html
1099- [cargo-remove]: https://doc.rust-lang.org/cargo/commands/cargo-remove.html
1100- [cargo-report]: https://doc.rust-lang.org/cargo/commands/cargo-report.html
1101- [cargo-run]: https://doc.rust-lang.org/cargo/commands/cargo-run.html
1102- [cargo-rustc]: https://doc.rust-lang.org/cargo/commands/cargo-rustc.html
1103- [cargo-rustdoc]: https://doc.rust-lang.org/cargo/commands/cargo-rustdoc.html
1104- [cargo-search]: https://doc.rust-lang.org/cargo/commands/cargo-search.html
1105- [cargo-test]: https://doc.rust-lang.org/cargo/commands/cargo-test.html
1106- [cargo-tree]: https://doc.rust-lang.org/cargo/commands/cargo-tree.html
1107- [cargo-uninstall]: https://doc.rust-lang.org/cargo/commands/cargo-uninstall.html
1108- [cargo-update]: https://doc.rust-lang.org/cargo/commands/cargo-update.html
1109- [cargo-vendor]: https://doc.rust-lang.org/cargo/commands/cargo-vendor.html
1110- [cargo-version]: https://doc.rust-lang.org/cargo/commands/cargo-version.html
1111- [cargo-yank]: https://doc.rust-lang.org/cargo/commands/cargo-yank.html
1116+ `CFLAGS` to ensure that the C components will link with Rust code.
0 commit comments