[RFC] Native Rust support #13415
anthonyshew
announced in
RFC
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Turborepo now experimentally supports Rust: https://turborepo.dev/docs/guides/tools/rust
Motivation
One of the longest-standing, open requests in Turborepo is to support more language toolchains than JavaScript: #683
This RFC seeks to introduce Rust as a natively supported language in Turborepo, with Cargo as the package manager.
What drives this ask?
Monorepos can be large, and don't have to contain just one language. It is common to run a monorepo with many languages and language toolchains in it. However, this comes with the complexity of managing workflows across all of these language toolchains. Each language toolchain creates its own partition within the monorepo, and it becomes complicated to manage the interactions between each language's domain.
Turborepo users see what Turborepo offers for simplifying their JavaScript/TypeScript workflows, and want the same for all languages in their repository. The canonical ask becomes "How do make
turbo run lintrun all the linters for all my languages?"Prior to this RFC, taking Turborepo across toolchains meant porting conventions of JS toolchains onto your other language toolchains. You'd have to put a
package.jsoninto your Rust workspaces for Turborepo to add it to your package graph, for example. A more verbose description of this can be found on our multi-language support documentation.With this new experimental support, these problems go away. Turborepo will infer the Cargo workspace naturally, in the same way that it infers JavaScript/TypeScript toolchains. Once (if?) we prove that Rust support is valuable for Turborepo, we can continue expanding to other languages.
Why Rust for the first language?
vercel/turborepoitself is a mixed-language repository, JavaScript + Rust. We've felt the aforementioned pain significantly, and know how we want our repo to work if everything were Turborepo. Because of this, we could quickly dogfood and iterate with the first non-JS language in our repo.We were able to see how this native support would help our users swiftly:
Dogfooding also means that coding agents were able to iterate on this experiment quickly. If something went wrong, it was able to course-correct in its own loop.
What about standalone Cargo workspaces?
Standalone Cargo workspaces are supported. Rust has excellent workspace support when using Cargo. It is true that Turborepo may only be able to bring marginal value to standalone Cargo workspaces, at a glance.
We are currently experimenting with approaches that could bring compile times down across CI machines. Compile times are a meaningful critique that exists for all Rust projects, and Turborepo could play a role in simplifying faster CI compilation.
Enabling for your Turborepo
a. Note that you are still required to use the npm ecosystem to install the
turbobinary.turbo.json.For more information on getting started, please see the link at the beginning of this post.
Usage
Using Turborepo for Rust should feel quite familiar to using it for JavaScript/TypeScript.
turbo run buildto build the binaries in your Cargo workspace.turbo run lintto run Clippy.turbo run checkto runcargo check --workspace.To learn more, please see the link at the beginning of this post.
What feedback is the Turborepo team looking for?
In short, everything. We want to hear about:
vercel/turborepois a mix of TypeScript and RustAll reactions