Skip to content

Commit 499f917

Browse files
committed
Switch to case-sensitive environment variable.
1 parent 3489428 commit 499f917

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/cargo/core/compiler/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -889,7 +889,7 @@ fn build_base_args<'a, 'cfg>(
889889
let exe_path = cx
890890
.files()
891891
.bin_link_for_target(bin_target, unit.kind, cx.bcx)?;
892-
let key = format!("CARGO_BIN_EXE_{}", bin_target.crate_name().to_uppercase());
892+
let key = format!("CARGO_BIN_EXE_{}", bin_target.name());
893893
cmd.env(&key, exe_path);
894894
}
895895
}

src/doc/src/reference/environment-variables.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,10 @@ let version = env!("CARGO_PKG_VERSION");
190190
* `CARGO_BIN_EXE_<name>` — The absolute path to a binary target's executable.
191191
This is only set when building an [integration test] or benchmark. This may
192192
be used with the [`env` macro] to find the executable to run for testing
193-
purposes. The `<name>` is the name of the binary converted to uppercase, and
194-
`-` converted to `_`. Binaries are automatically built when the test is
195-
built, unless the binary has required features that are not enabled.
193+
purposes. The `<name>` is the name of the binary target, exactly as-is. For
194+
example, `CARGO_BIN_EXE_my-program` for a binary named `my-program`.
195+
Binaries are automatically built when the test is built, unless the binary
196+
has required features that are not enabled.
196197

197198
[integration test]: manifest.md#integration-tests
198199
[`env` macro]: ../../std/macro.env.html

tests/testsuite/test.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4029,9 +4029,9 @@ fn bin_env_for_test() {
40294029
&r#"
40304030
#[test]
40314031
fn run_bins() {
4032-
assert_eq!(env!("CARGO_BIN_EXE_FOO"), "<FOO_PATH>");
4033-
assert_eq!(env!("CARGO_BIN_EXE_WITH_DASH"), "<WITH_DASH_PATH>");
4034-
assert_eq!(env!("CARGO_BIN_EXE_GRÜSSEN"), "<GRÜSSEN_PATH>");
4032+
assert_eq!(env!("CARGO_BIN_EXE_foo"), "<FOO_PATH>");
4033+
assert_eq!(env!("CARGO_BIN_EXE_with-dash"), "<WITH_DASH_PATH>");
4034+
assert_eq!(env!("CARGO_BIN_EXE_grüßen"), "<GRÜSSEN_PATH>");
40354035
}
40364036
"#
40374037
.replace("<FOO_PATH>", &bin_path("foo"))

0 commit comments

Comments
 (0)