Skip to content

CARGO env variable does not get set when running commands #1059

@wmmc88

Description

@wmmc88

Describe The Bug

The README describes

When defined with scripts (as opposed to commands), the CARGO environment variable will be defined for the requested toolchain.

Although this says it doesn't define it for commands, I think this should so that the behavior matches with running via rustup or cargo +toolchain.

To Reproduce

build.rs:

use std::path::PathBuf;
use std::env;

fn main() {
    panic!("{:#?}", env::var("CARGO").map(PathBuf::from).unwrap());
}

Makefile.toml:

[tasks.nightly-build]
toolchain = "nightly"
extend = "build"

These commands panic with stable toolchain path:
cargo build
rustup run stable cargo build
cargo make build
cargo make nightly-build

These commands panic with nightly toolchain path:
cargo +nightly build
rustup run nightly cargo build

The issue here is that cargo make nightly-build should print the nightly toolchain path. Something in cargo-make is preventing it from doing that.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions