|
| 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