Replace deprecated cargo_bin with cargo_bin! macro #579
+49
−42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
assert_cmd::cargo::cargo_bin()function relies on Cargo's internal directory structure to locate test binaries. This breaks whenCARGO_BUILD_BUILD_DIRis set, and will fail with upcoming Cargo changes (rust-lang/cargo#16147, rust-lang/cargo#15010).Changes
Separated integration test utilities from shared test utilities
tests/integration_util.rscontainingrun()andmain_binary()usingcargo_bin!()macrotests/util/mod.rs(shared by integration and unit tests)tests/main.rsimportsWhy the separation?
The
cargo_bin!()macro expands toenv!("CARGO_BIN_EXE_cargo-mutants"), which is only available at compile-time for integration test binaries. The sharedtests/util/mod.rsis included in unit tests viasrc/main.rs, where this environment variable doesn't exist. Separating the modules allowscargo check --all-targetsto succeed while using the stableCARGO_BIN_EXE_*API.Original prompt
assert_cmd::cargo_binwhich will break on future Cargo versions #578💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.