Tests assumes the location of the [[bin]] based on the location of a [[test]]
You can reproduce this by running either:
$ cargo +nightly test -Zbuild-dir-new-layout
$ CARGO_BUILD_BUILD_DIR=build cargo test
In Cargo 1.94, CARGO_BIN_EXE_* was stabilized for use at runtime, , see assert_cmd::cargo::cargo_bin for an example which supports both old and new Cargo versions.
Libraries that provide this look up as an API include:
Common other problems to watch for:
- Mixing this with old versions of the libraries listed above that also need updating
- Doing this lookup during unit tests when the binary is only guaranteed to be around for integration tests (and
CARGO_BIN_EXE_* is only exposed to them)
This problem was identified by the following crater run: rust-lang/rust#149852
Tests assumes the location of the
[[bin]]based on the location of a[[test]]build.build-dir(added as of Cargo 1.91)build-dirlayout (Re-organize build-dir by package + hash, rather than artifact type rust-lang/cargo#15010)build.build-dirdefault (Movebuild-dirout of the workspace tocargo-cache-homeby default rust-lang/cargo#16147)You can reproduce this by running either:
In Cargo 1.94,
CARGO_BIN_EXE_*was stabilized for use at runtime, , seeassert_cmd::cargo::cargo_binfor an example which supports both old and new Cargo versions.Libraries that provide this look up as an API include:
Common other problems to watch for:
CARGO_BIN_EXE_*is only exposed to them)This problem was identified by the following crater run: rust-lang/rust#149852