Skip to content

rustup run $toolchain cargo succeeds even if $toolchain is not installed #792

Closed
@kamalmarhubi

Description

@kamalmarhubi

This is unexpected, and can lead to confusion if trying out cargo build or cargo test with some older versions. You end up silently building against nightly instead (see below).

$ rustup --version
rustup 0.6.4 (e6dc1c6 2016-10-24)
$ rustup run 1.0 rustc --version
error: toolchain '1.0' is not installed
$ rustup run 1.0 cargo --version
cargo 0.13.0-nightly (717adc8 2016-11-02)

The call to cargo should fail as well.

To demonstrate that other non-cargo commands do not run:

$ rustup run 1.0 which cargo
error: toolchain '1.0' is not installed

It seems that the silent successful cargo commands use nightly:

$ cd $(mktemp -d)
$ cargo new bad  # to get a valid Cargo.toml
     Created library `bad` project
$ cd bad
$ rustup run 1.0 cargo rustc does-not-exist.rs -- --version
   Compiling bad v0.1.0 (file:///tmp/tmp.iiZg2tF5CK/bad)
rustc 1.14.0-nightly (5665bdf3e 2016-11-02)
    Finished debug [unoptimized + debuginfo] target(s) in 0.2 secs

I think it's using the nightly channel and not a specific nightly, as I hadn't installed 2016-11-02 explicitly:

$ ls $HOME/.multirust/toolchains
1.2.0-x86_64-unknown-linux-gnu  nightly-2016-10-26
1.8.0-x86_64-unknown-linux-gnu  nightly-2016-10-28
beta-x86_64-unknown-linux-gnu   nightly-x86_64-unknown-linux-gnu
nightly-2016-10-09              stable-x86_64-unknown-linux-gnu
nightly-2016-10-19

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions