Closed
Description
Problem
Starting with 1.52 (currently in beta), Cargo will prevent crates from setting RUSTC_BOOTSTRAP via build scripts. However, that prevention can be by-passed with an explicit RUSTC_BOOTSTRAP=1 in the environment. Cargo misleadingly tells users that RUSTC_BOOTSTRAP=<crate-name>
will be sufficient to bypass the error.
Steps
Cargo.toml:
[package]
name = "foo"
version = "0.1.0"
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
obfstr = "=0.2.1" # pin to a version that sets this variable
Running with the bootstrap variable setup as Cargo asks:
$ RUSTC_BOOTSTRAP=obfstr cargo +beta build
Compiling obfstr v0.2.1
error: Cannot set `RUSTC_BOOTSTRAP=1` from build script of `obfstr v0.2.1`.
note: Crates cannot set `RUSTC_BOOTSTRAP` themselves, as doing so would subvert the stability guarantees of Rust for your project.
help: If you're sure you want to do this in your project, set the environment variable `RUSTC_BOOTSTRAP=obfstr` before running cargo instead.
Possible Solution(s)
Likely we should either:
- enable nightly features in Cargo if any value of rustc_bootstrap is defined
- adjust the message to indicate =1 (but @joshtriplett IIRC was against this approach)