Skip to content

CARGO environment variable, if set to a proxy, should be changed to match the selected toolchain #4274

Closed
@ChrisDenton

Description

@ChrisDenton

Problem you are trying to solve

This is a follow up to rust-lang/cargo#15099

In short, it used to be that setting the CARGO environment variable to, e.g. $CARGO_HOME/bin/cargo prior to invoking cargo could result in mismatched toolchains when cargo is managed by rustup, E.g. cargo +nightly will run the nightly cargo but later use of the CARGO environment variable would mean running the default toolchain instead (which may be different).

That issue is fixed for newer versions of Cargo but rustup obviously supports installing old versions. Should we make a best effort to ensure the CARGO environment variable is correctly set to the right toolchain when running via a proxy?

Solution you'd like

If running cargo via rustup and if the CARGO environment variable is set to a rustup proxy (e.g. as in rustup managed $CARGO_HOME/bin/cargo) then set CARGO to the actual path for cargo.

Notes

This mimics newer cargo behaviour. We shouldn't go out of our way to fix this in all cases but if a minimal change works around this issue in most cases then it would still be useful, I think.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions