0

Update Rust guidelines

Update docs/rust.md and docs/adding_to_third_party.md to remove the 3P restriction. For an extended description of the new process and rationale for changing it, Googlers can see go/rethinking-rust-approvals-chrome.

Change-Id: Ifb6acd08e11eafcbbbe7823803033d38bd384974
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5980554
Commit-Queue: David Adrian <dadrian@google.com>
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Nasko Oskov <nasko@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1395613}
This commit is contained in:
David Adrian
2024-12-12 14:02:50 -08:00
committed by Chromium LUCI CQ
parent 51e2da7845
commit d8918699cd
2 changed files with 15 additions and 20 deletions

@ -78,25 +78,15 @@ questions.
### Rust
Rust is allowed for third-party libraries as long as there is a business need,
which includes the following:
Rust is allowed for third party libraries. Unlike C++ libraries, Rust third
party libraries are [regularly rolled to updated versions by a
rotation](https://chromium.googlesource.com/chromium/src/tools/+/HEAD/crates/create_update_cl.md)
and can be audited for unsafety. The process for adding a Googler adding new Rust third-party
dependencies is documented at go/chrome-rust. External contributors adding a new
third party Rust dependency will be shepherded through the process as part of
their ATL review.
* The Rust implementation is the best (e.g., speed, memory, lack of bugs) or
only existing implementation available for the third-party library.
* The Rust implementation allows the operation to move to a higher privileged
process, and this benefits the product by improving on guardrail metrics (e.g.
through avoiding process startup, IPC overheads, or C++ memory-unsafety
mitigations).
* The Rust implementation can meaningfully reduce our expected risk of
(memory/crashes/undefined behavior) bugs, when compared to the existing
third-party library and related C++ code required to use the library. We realize
assessing risk is quite complex and very nuanced. If this is the criteria by
which the third-party library is being added, chrome-atls-discuss@google.com and
chrome-rust@google.com may ask for more data.
Support for third-party libraries written in Rust is in active development. If
the library you wish to add is in Rust, reach out to chrome-rust@google.com
first.
Email rust-dev@chromium.org with any questions about the Rust toolchain.
### A note on size constraints

@ -19,8 +19,11 @@ The Rust toolchain is enabled for and supports all platforms and development
environments that are supported by the Chromium project. The first milestone
to include full production-ready support was M119.
Rust is approved by Chrome ATLs for production use in
[certain third-party scenarios](../docs/adding_to_third_party.md#Rust).
Rust can be used anywhere in the Chromium repository (not just `//third_party`)
subject to [current interop capabilities][interop-rust-doc], however it is
currently subject to a internal approval and FYI process. Googlers can view
go/chrome-rust for details. New usages of Rust are documented at
[`rust-fyi@chromium.org`](https://groups.google.com/a/chromium.org/g/rust-fyi).
For questions or help, reach out to `rust-dev@chromium.org` or `#rust` on the
[Chromium Slack](https://www.chromium.org/developers/slack/).
@ -334,3 +337,5 @@ but you can still add dependencies manually to your `Cargo.toml`:
[dependencies]
log = "0.4"
```
[interop-rust-doc]: https://docs.google.com/document/d/1kvgaVMB_isELyDQ4nbMJYWrqrmL3UZI4tDxnyxy9RTE/edit?tab=t.0#heading=h.fpqr6hf3c3j0