aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-27 13:26:18 +0000
committerGitHub <[email protected]>2021-01-27 13:26:18 +0000
commite3204c528b44ef676362d6fc27a72cac868dfbdb (patch)
tree787bb42b245b3fca4efa72c9c5c1359ecc86627e /crates
parent6a6a80eb1fba0f9d206f9384ecb78bf4ac87691e (diff)
parent481a74eda7d004ec4a9992834d098fc0280d2a36 (diff)
Merge #7464
7464: Export `CARGO` for proc. macros r=jonas-schievink a=jonas-schievink Fixes https://github.com/rust-analyzer/rust-analyzer/issues/7462 bors r+ Co-authored-by: Jonas Schievink <[email protected]>
Diffstat (limited to 'crates')
-rw-r--r--crates/project_model/src/build_data.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/crates/project_model/src/build_data.rs b/crates/project_model/src/build_data.rs
index cf32995e0..3ff347e2c 100644
--- a/crates/project_model/src/build_data.rs
+++ b/crates/project_model/src/build_data.rs
@@ -175,7 +175,7 @@ fn is_dylib(path: &Path) -> bool {
175/// Should be synced with <https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates> 175/// Should be synced with <https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates>
176fn inject_cargo_env(package: &cargo_metadata::Package, env: &mut Vec<(String, String)>) { 176fn inject_cargo_env(package: &cargo_metadata::Package, env: &mut Vec<(String, String)>) {
177 // FIXME: Missing variables: 177 // FIXME: Missing variables:
178 // CARGO, CARGO_PKG_HOMEPAGE, CARGO_CRATE_NAME, CARGO_BIN_NAME, CARGO_BIN_EXE_<name> 178 // CARGO_PKG_HOMEPAGE, CARGO_CRATE_NAME, CARGO_BIN_NAME, CARGO_BIN_EXE_<name>
179 179
180 let mut manifest_dir = package.manifest_path.clone(); 180 let mut manifest_dir = package.manifest_path.clone();
181 manifest_dir.pop(); 181 manifest_dir.pop();
@@ -183,6 +183,9 @@ fn inject_cargo_env(package: &cargo_metadata::Package, env: &mut Vec<(String, St
183 env.push(("CARGO_MANIFEST_DIR".into(), cargo_manifest_dir.into())); 183 env.push(("CARGO_MANIFEST_DIR".into(), cargo_manifest_dir.into()));
184 } 184 }
185 185
186 // Not always right, but works for common cases.
187 env.push(("CARGO".into(), "cargo".into()));
188
186 env.push(("CARGO_PKG_VERSION".into(), package.version.to_string())); 189 env.push(("CARGO_PKG_VERSION".into(), package.version.to_string()));
187 env.push(("CARGO_PKG_VERSION_MAJOR".into(), package.version.major.to_string())); 190 env.push(("CARGO_PKG_VERSION_MAJOR".into(), package.version.major.to_string()));
188 env.push(("CARGO_PKG_VERSION_MINOR".into(), package.version.minor.to_string())); 191 env.push(("CARGO_PKG_VERSION_MINOR".into(), package.version.minor.to_string()));