Skip to content

Commit fbe6b78

Browse files
committed
add goal for build-std
1 parent bf4ae18 commit fbe6b78

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed

src/2025h1/build-std.md

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# build-std
2+
3+
| Metadata | |
4+
| -------- | ---------------- |
5+
| Owner(s) | Rust team at Arm |
6+
| Teams | [cargo] |
7+
| Status | Proposed |
8+
9+
*Arm's Rust team is @davidtwco, @adamgemmell, @jacobbramley, @JamieCunliffe and @Jamesbarford. This
10+
goal will be primarily worked on by @adamgemmell, but @davidtwco can always be contacted for
11+
updates.*
12+
13+
## Summary
14+
15+
Write an RFC for a minimum viable product (MVP) of build-std which has the potential to be
16+
stabilised once implemented (as opposed to the currently implemented MVP which is only suitable for
17+
experimentation and testing), and then implement it.
18+
19+
## Motivation
20+
21+
build-std is a well-known unstable feature in Cargo which enables Cargo to re-build the standard
22+
library, this is useful for a variety of reasons:
23+
24+
- Building the standard library for targets which do not ship with a pre-compiled standard library.
25+
- Optimising the standard library for known hardware, such as with non-baseline target features
26+
or options which optimise for code size. This is a common use case for embedded developers.
27+
- Re-building the standard library with different configuration options (e.g. changing the
28+
optimisation level, using flags which change the ABI, or which add additional exploit
29+
mitigations).
30+
- Re-building the standard library with different `cfg`s (e.g. disabling `backtrace` in std).
31+
- Stabilisation of various compiler flags which change the ABI, add additional exploit
32+
mitigations (such as `-Zsanitizers=cfi` or `-Zbranch-protection`), or which otherwise only make
33+
sense to use when the entire program is compiled with the flag (including std) is blocked on
34+
these being unable to be used properly without being able to rebuild std.
35+
36+
These features are more useful for some subsets of the Rust community, such as embedded developers
37+
where optimising for size can be more important and where the targets often don't ship with a
38+
pre-compiled std.
39+
40+
Rust for Linux and some other projects have a requirement to build core themselves without Cargo
41+
(ideally using the same stable compiler they use for the rest of their project), which is a shared
42+
requirement with build-std, as whatever mechanism these projects end up using could be re-used by
43+
the implementation of build-std and vice-versa.
44+
45+
### The status quo
46+
47+
build-std is currently an unstable feature in Cargo which hasn't seen much development or progress
48+
since its initial development in 2019/2020. There are a variety of issues in the
49+
[wg-cargo-std-aware][wg-cargo-std-aware] repository which vary from concrete bugs in the current
50+
experimental implementation to vague "investigate and think about this" issues, which make the
51+
feature difficult to make progress on.
52+
53+
[wg-cargo-std-aware]: https://github.com/rust-lang/wg-cargo-std-aware
54+
55+
### The next 6 months
56+
57+
There are two primary objectives of this goal in its first six months:
58+
59+
- Firstly, we will write an MVP RFC that will limit the scope of the feature and make it easier
60+
to make progress on build-std.
61+
62+
It is intended that this RFC will summarize all of the previous discussion, use cases and
63+
feedback on build-std. In this documenting of the current state of build-std, this RFC
64+
will be well-positioned to propose which use cases should and should not be resolved by
65+
build-std (for the final feature, not just this MVP). For example, this RFC will decide
66+
whether patching or modifying std is a supported use case for build-std.
67+
68+
For those use cases solved by build-std, the RFC will select a subset for the new MVP of
69+
build-std. It is intended that this MVP be sufficiently useful and complete that it could
70+
be stabilised. The design of the MVP will be forward-compatible with all of the other use
71+
cases that build-std is intended to solve.
72+
73+
It is hoped that this RFC should demonstrate a thorough understanding of the design space
74+
of build-std and give the responsible upstream teams confidence in our ownership of this
75+
feature, and enabling those teams to make a fully informed decision on any proposals made.
76+
77+
- Next, after and conditional on acceptance of this RFC, we will proceed with its
78+
implementation.
79+
80+
### The "shiny future" we are working towards
81+
82+
After the approval and implementation of the MVP RFC, there will naturally be follow-up use cases
83+
which can be designed and implemented to complete the build-std feature.
84+
85+
## Design axioms
86+
87+
- Enabling build-std without changing any compilation options or configuration should produce an
88+
equivalent library to that distributed by the project.
89+
- Avoid precluding future extensions to build-std.
90+
- build-std should allow std/alloc/core to be treated more like other dependencies than currently.
91+
- This represents a general move away from treating std/alloc/core as a special case.
92+
93+
## Ownership and team asks
94+
95+
| Subgoal | Owner(s) or team(s) | Notes |
96+
| ---------------------------------------------- | -------------------- | ----- |
97+
| Discussion and moral support | ![Team][] [cargo] | |
98+
| Stabilise MVP of build-std | @adamgemmell | |
99+
| ↳ Author RFC | @adamgemmell | |
100+
| ↳ Implementation | @adamgemmell | |
101+
| ↳ Standard reviews | ![Team][] [cargo] | |
102+
| ↳ RFC decision | ![Team][] [cargo] | |
103+
| ↳ Author stabilization report | @adamgemmell | |
104+
| ↳ Stabilization decision | ![Team][] [cargo] | |
105+
106+
### Definitions
107+
108+
Definitions for terms used above:
109+
110+
* *Discussion and moral support* is the lowest level offering, basically committing the team to nothing but good vibes and general support for this endeavor.
111+
* *Author RFC* and *Implementation* means actually writing the code, document, whatever.
112+
* *Design meeting* means holding a synchronous meeting to review a proposal and provide feedback (no decision expected).
113+
* *RFC decisions* means reviewing an RFC and deciding whether to accept.
114+
* *Org decisions* means reaching a decision on an organizational or policy matter.
115+
* *Secondary review* of an RFC means that the team is "tangentially" involved in the RFC and should be expected to briefly review.
116+
* *Stabilizations* means reviewing a stabilization and report and deciding whether to stabilize.
117+
* *Standard reviews* refers to reviews for PRs against the repository; these PRs are not expected to be unduly large or complicated.
118+
* *Prioritized nominations* refers to prioritized lang-team response to nominated issues, with the expectation that there will be *some* response from the next weekly triage meeting.
119+
* *Dedicated review* means identifying an individual (or group of individuals) who will review the changes, as they're expected to require significant context.
120+
* Other kinds of decisions:
121+
* [Lang team experiments](https://lang-team.rust-lang.org/how_to/experiment.html) are used to add nightly features that do not yet have an RFC. They are limited to trusted contributors and are used to resolve design details such that an RFC can be written.
122+
* Compiler [Major Change Proposal (MCP)](https://forge.rust-lang.org/compiler/mcp.html) is used to propose a 'larger than average' change and get feedback from the compiler team.
123+
* Library [API Change Proposal (ACP)](https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html) describes a change to the standard library.
124+
125+
## Frequently asked questions
126+
127+
None yet.

0 commit comments

Comments
 (0)