Skip to content

Commit b6cccd2

Browse files
committed
add the rfc
1 parent 2b78d7b commit b6cccd2

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

text/0000-cargo-check-lang-policy.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
- Feature Name: `cargo-check-lang-policy`
2+
- Start Date: 2023-08-22
3+
- RFC PR: [rust-lang/rfcs#0000](https://github.com/rust-lang/rfcs/pull/0000)
4+
- Rust Issue: [rust-lang/rust#0000](https://github.com/rust-lang/rust/issues/0000)
5+
6+
# Summary
7+
[summary]: #summary
8+
9+
This RFC helps to codify the T-lang policy regarding `cargo check` vs `cargo build`.
10+
11+
This is a policy RFC rather than a change to the language itself, and is thus "instantly stable" once accepted. There's no associated feature within the compiler, and no further stabilization report necessary.
12+
13+
# Motivation
14+
[motivation]: #motivation
15+
16+
It has often come up within GitHub issues what *exactly* the intended line is between Cargo's `check` and `build` commands should be, what users should expect, and so on.
17+
18+
The RFC gives a clear policy from T-lang's perspective so that both other teams within the Rust project as well as users of the Rust project can have the same expectations.
19+
20+
# Decision
21+
[decision]: #decision
22+
23+
* `cargo build` catches all Rust compilation errors.
24+
* `cargo check` only catches some subset of the possible compilation errors.
25+
* A Rust program **must** compile with `cargo build` to be covered by Rust's standard stability guarantee.
26+
27+
Specifically, if a given Rust program passes `cargo check` but **not** `cargo build` in one version of Rust, then in any future version of Rust that program *can* begin to also fail `cargo check`, and this is **not** considered a breaking change.
28+
29+
`cargo check` should catch as many errors as possible, but the emphasis is on giving a fast answer rather than giving a complete answer. If you need a complete answer then you need to use `cargo build`.
30+
31+
The optimization level of the compiler **should not** affect if the program compiles or not (using `build` or `check`). Any such case is very likely a bug, and T-lang will have to make a determination on a case-by-case basis.
32+
33+
# Unresolved questions
34+
[unresolved-questions]: #unresolved-questions
35+
36+
* Is there any situation when we would *want* to allow optimization level to affect if a program passes or fails a build? This seems unlikely.
37+
38+
# Future possibilities
39+
[future-possibilities]: #future-possibilities
40+
41+
* Any future changes in this policy would require a future RFC so that such changes are as clear and visible as possible.

0 commit comments

Comments
 (0)