From 9ba48bffb2d19885824e0bcd052c2b3f1e11454a Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Fri, 13 Jan 2023 15:00:14 +0100 Subject: [PATCH] Clarify the difference between CARGO_CRATE_NAME and CARGO_PKG_NAME --- src/doc/src/reference/environment-variables.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/doc/src/reference/environment-variables.md b/src/doc/src/reference/environment-variables.md index d49922afbfde..1675b3770c42 100644 --- a/src/doc/src/reference/environment-variables.md +++ b/src/doc/src/reference/environment-variables.md @@ -231,7 +231,7 @@ corresponding environment variable is set to the empty string, `""`. * `CARGO_PKG_RUST_VERSION` — The Rust version from the manifest of your package. Note that this is the minimum Rust version supported by the package, not the current Rust version. -* `CARGO_CRATE_NAME` — The name of the crate that is currently being compiled. +* `CARGO_CRATE_NAME` — The name of the crate that is currently being compiled. It is the name of the [Cargo target] with `-` converted to `_`, such as the name of the library, binary, example, integration test, or benchmark. * `CARGO_BIN_NAME` — The name of the binary that is currently being compiled (if it is a binary). This name does not include any file extension, such as `.exe`. * `OUT_DIR` — If the package has a build script, this is set to the folder where the build script should place its output. See below for more information. @@ -255,6 +255,7 @@ corresponding environment variable is set to the empty string, `""`. the tests/benches. Cargo initially creates this directory but doesn't manage its content in any way, this is the responsibility of the test code. +[Cargo target]: cargo-targets.md [integration test]: cargo-targets.md#integration-tests [`env` macro]: ../../std/macro.env.html