Skip to content

Improve "invoke \cargo\ through \rustup\ to handle \+toolchain\" comment to be more helpful #16149

@sliedes

Description

@sliedes

Problem

I today for the first time tried to run MIRI and discovered I needed to use an unstable toolchain. I figured out how that can be installed using rustup, but then got this:

$ cargo +nightly miri test
error: no such command: `+nightly`

help: invoke `cargo` through `rustup` to handle `+toolchain` directives

Based on this, I tried all kinds of things (including reading through documentation), yet it took me probably 20 minutes to figure out the correct syntax. I tried:

rustup +toolchain run cargo miri test
rustup run +toolchain cargo miri test

... etc. I found many mentions of cargo +toolchain on the net, but it was really quite hard to find the syntax to actually get this to run. One reason is that as a beginner I really had no idea if I was looking for an option to run, not rustup or cargo..

Proposed Solution

Now, having found that the correct invocation is rustup run nightly cargo miri test, I think it would have been most helpful if the "help:" message would have given a bigger hint, maybe something like

help: Use `rustup run <toolchain> cargo ...` instead of `cargo +toolchain`.

, or even pointing me, the new user, to rustup run --help.

Notes

Place in code:

help: invoke `cargo` through `rustup` to handle `+toolchain` directives{script_suggestion}",

A related issue which lead to some changes to make this supposedly easier to discover: #8058

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Error and warning messages generated by Cargo itself.C-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-mentorStatus: Issue or feature is accepted, but needs a team member to commit to helping and reviewing.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions