Skip to content

Commit 3e6af69

Browse files
committed
Add bridge between incrementals, first draft
1 parent f5c22e2 commit 3e6af69

File tree

1 file changed

+99
-0
lines changed

1 file changed

+99
-0
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
# Bridge between incremental caches for all tools
2+
3+
| Metadata | |
4+
|:-----------------|----------------------------------------------------------------------------------|
5+
| Point of contact | @blyxyas |
6+
| Teams | (probably WG-incremental but waiting approval by them) |
7+
| Task owners | @blyxyas |
8+
| Status | Proposed |
9+
| Tracking issue | |
10+
| Zulip channel | |
11+
12+
## Summary
13+
14+
The goal of this project goal is to make a compatibility layer to share incremental compilation information between
15+
`cargo check`, `cargo build`, and any other external tool that might benefit from sharing incremental information
16+
such as `cargo clippy`.
17+
18+
## Motivation
19+
20+
Redoing work between `cargo check`, `cargo build` and other commands such as `cargo clippy` is one of the greatest pain
21+
points in the realm of compiler performance. Being able to reuse this information would speed up by a lot both
22+
CI/CD pipelines as well as the developer feedback loop. Making Rust a more pleasing experience to work with and
23+
reducing the inherent "time punishment" when handling large projects.
24+
25+
### The status quo
26+
27+
Currently running Rust on CI largely consists of unconnected stages for checking, linting, and building/testing. In a
28+
scenario where time is literally money we're redoing a very large amount of work for lack of a better system. On local
29+
user's machines, we're producing the same information several times even with persistent incremental directories.
30+
31+
As an example, running `cargo check` and then `cargo clippy` will double the `target` directory size.
32+
33+
### The next 6 months
34+
35+
The plan to continue looks something like this:
36+
37+
- Identify what information is individual to each workflow and which is repeated information.
38+
- Create an information protocol that all Rust builds produce containing module metadata and compilation information.
39+
- And adapt existing APIs in order to facilitate as much as possible information sharing between different tools with different needs.
40+
41+
### The "shiny future" we are working towards
42+
43+
The ideal future would be one in which all Rust compilation-adjacent activities can share a robust common ground, extensible
44+
enough for any tool to privately use. With the end goal of speeding up compiler performance on incremental, linting performance
45+
and shrinking incremental sizes.
46+
47+
In this ideal scenario, any existing or future team / even third-party project (although not a priority) could hook up their
48+
compilation-adjacent project to an existing incremental compilation directory and gather all useful information. As a result,
49+
no matter how many different activities or tools the user uses. The incremental directory size would not be linear but closer
50+
to logarithmic.
51+
52+
As a technical detail, in this ideal scenario each compiler-adjacent activity would emit and request a subset of data such as
53+
module information or targets, available for all other activities to extend and/or use.
54+
55+
## Design axioms
56+
57+
- **Atomic and usable without external requirements**, the protocol should be as open-ended as possible in order to facilitate collaboration between tools.
58+
- **Activities operate on a request - emit scheme**, every and any activity should be able to request or emit compilation information via a straightforward way (yet to determine)
59+
- **Link all information to module data**, if a module data dependency doesn't change, a different activity shouldn't be reran. If an activity A is ran after an activity B, don't force A to be reran because B has changed unrelated hashes.
60+
61+
## Ownership and team asks
62+
63+
| Task | Owner(s) or team(s) | Notes |
64+
|--------------------------------|---------------------------------------------|-------|
65+
| Initial design proposal | @blyxyas | |
66+
| Discussion on the design | [Help Wanted, wg-incremental, cargo?] | |
67+
| Implementation | @blyxyas | |
68+
| Revision of the implementation | [Help Wanted], wg-incremental? | |
69+
70+
### Definitions
71+
72+
For definitions for terms used above, see the [About > Team Asks](https://rust-lang.github.io/rust-project-goals/about/team_asks.html) page.
73+
74+
* *Discussion and moral support* is the lowest level offering, basically committing the team to nothing but good vibes and general support for this endeavor.
75+
* *Author RFC* and *Implementation* means actually writing the code, document, whatever.
76+
* *Design meeting* means holding a synchronous meeting to review a proposal and provide feedback (no decision expected).
77+
* *RFC decisions* means reviewing an RFC and deciding whether to accept.
78+
* *Org decisions* means reaching a decision on an organizational or policy matter.
79+
* *Secondary review* of an RFC means that the team is "tangentially" involved in the RFC and should be expected to briefly review.
80+
* *Stabilizations* means reviewing a stabilization and report and deciding whether to stabilize.
81+
* *Standard reviews* refers to reviews for PRs against the repository; these PRs are not expected to be unduly large or complicated.
82+
* *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.
83+
* *Dedicated review* means identifying an individual (or group of individuals) who will review the changes, as they're expected to require significant context.
84+
* Other kinds of decisions:
85+
* [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.
86+
* 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.
87+
* Library [API Change Proposal (ACP)](https://std-dev-guide.rust-lang.org/development/feature-lifecycle.html) describes a change to the standard library.
88+
89+
## Frequently asked questions
90+
91+
### Why is the cargo team being mentioned?
92+
93+
Being that Cargo is by far the most popular interface into the Rust compiler, I think that they should be aware of this change in architecture. Maybe they have any requirement they'd like to voice out or concern they'd like to iron out before proceeding with any testing / design.
94+
95+
<!--
96+
### What do I do with this space?
97+
98+
*This is a good place to elaborate on your reasoning above -- for example, why did you put the design axioms in the order that you did? It's also a good place to put the answers to any questions that come up during discussion. The expectation is that this FAQ section will grow as the goal is discussed and eventually should contain a complete summary of the points raised along the way.*
99+
-->

0 commit comments

Comments
 (0)