Confirmed users
1,345
edits
Nnethercote (talk | contribs) No edit summary |
Nnethercote (talk | contribs) |
||
| Line 6: | Line 6: | ||
The goal of this section is to provide some high-level guidelines, but not to serve as any kind of gatekeeping function. Choice of language is an engineering decision, with corresponding trade-offs, and is best decided by individual teams. With that in mind... | The goal of this section is to provide some high-level guidelines, but not to serve as any kind of gatekeeping function. Choice of language is an engineering decision, with corresponding trade-offs, and is best decided by individual teams. With that in mind... | ||
== Summary == | |||
When should Rust be used in Firefox? In summary: | When should Rust be used in Firefox? In summary: | ||
* For new components and completely rewritten components there should be a strong bias towards using Rust, especially for code around Firefox but not within Firefox. | * For new components and completely rewritten components there should be a strong bias towards using Rust, especially for code around Firefox but not within Firefox. | ||
* For existing components it's more complicated! | * For existing components it's more complicated! | ||
== Rust Strengths == | |||
Rust has the following strengths. | Rust has the following strengths. | ||
| Line 17: | Line 21: | ||
* A great community. | * A great community. | ||
Rust | == Rust Weaknesses | ||
One major issue with Rust relates to personnel. There is a wide variety of experience levels within Mozilla, for both coding and reviewing. Also, Rust's learning curve is steep at the start, which can be intimidating. | |||
There are also technical challenges. | |||
* Compile times are currently slow. | |||
* Crossing the C++/Rust boundary layer can be difficult, and is relatively slow due to no inlining. | |||
** Bindgen can be tricky, especially working around clang bugs in different versions | |||
* Android is currently not a Tier 1 platform | |||
** https://forge.rust-lang.org/platform-support.html | |||
** Hasn't shipped on many devices yet | |||
** Rust 1.22 should be better? | |||
** rillian: "As I understand it, the problem is no one has set up tests on a cloud service, so there's no way for upstream to gate work on Android regressions. Qemu emulation is too slow. There aren't many services with arm support, but there are a couple of new options. If someone does the work of setting something up we should be able to get the Rust team to adopt it." | |||
* Often requires adding wrapper/glue code | |||
** But this is typically valuable/reusable | |||
* Sharing components between Gecko and Servo is difficult | |||
** The workflow is annoying | |||
** There are continuous integration mismatches | |||
** Servo CI is under-resourced? | |||
** vcs-sync/Phabricator/Lando should fix this? | |||
** This is not relevant for Gecko-only Rust components, however. | |||
== Recommendations == | |||
Therefore, Rust is most suitable in the following situations. | Therefore, Rust is most suitable in the following situations. | ||