Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly is a Rust "toolchain"?

I've seen rustup be referred to as a "toolchain installer", but it's hard to find an exact definition of what Rust considers a "toolchain" to be and what the scope is for the concept.

I already have the Rust compiler and Cargo installed. What more does rustup bring? Is it just a Rust-version-switcher?


As a .NET-developer, maybe there is there a parallel which makes it easier for me to grasp this concept?

like image 874
Seb Nilsson Avatar asked Jun 16 '20 20:06

Seb Nilsson


People also ask

Where is Rust toolchain installed?

In the Rust development environment, all tools are installed to the ~/. cargo/bin. directory, and this is where you will find the Rust toolchain, including rustc , cargo , and rustup .

What is Rustup used for?

Rustup is the official tool used to manage Rust tooling. Not only can it be used to install Rust and keep it updated, it also allows you to seamlessly switch between the stable, beta, and nightly Rust compilers and tooling.

What is cargo Rustup?

rustup is a toolchain multiplexer. It installs and manages many Rust toolchains and presents them all through a single set of tools installed to ~/. cargo/bin . The rustc and cargo executables installed in ~/. cargo/bin are proxies that delegate to the real toolchain.

What is Rust nightly?

A new feature is added to Rust: a new commit lands on the master branch. Each night, a new nightly version of Rust is produced. Every day is a release day, and these releases are created by our release infrastructure automatically. So as time passes, our releases look like this, once a night: nightly: * - - * - - *


1 Answers

A toolchain is a specific version of the collection of programs needed to compile a Rust application. It includes, but is not limited to:

  • The compiler, rustc
  • The dependency manager and build tool, cargo
  • The documentation generator, rustdoc
  • The static and/or dynamic libraries comprising the standard library for the default platform

There are additional components that can be installed, such as

  • Documentation
    • The Rust Programming Language
    • The standard library
    • Various books and references
  • The static and/or dynamic libraries comprising the standard library for additional platforms to cross-compile to
  • The source code for the standard library
  • Extra utilities
    • Code formatting via rustfmt
    • Extra lints via clippy
    • Undefined behavior checking via miri
    • Advanced editor support via rust-analyzer or the Rust Language Server

Rustup provides ways to install, remove, update, select and otherwise manage these toolchains and their associated pieces.

See also:

  • How to install a Rust target for a specific rustup toolchain?
  • How to remove Rust compiler toolchains with Rustup?
  • How to switch between rust toolchains
  • How do I tell which Windows toolchain my Rust compiler is using?
  • How to execute cargo test using the nightly channel?
like image 114
Shepmaster Avatar answered Oct 24 '22 00:10

Shepmaster