Skip to content

Commit 431aab1

Browse files
committed
Remove CARGO_RUSTC_CURRENT_DIR
1 parent 87c733c commit 431aab1

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

src/tools/rust-analyzer/crates/project-model/src/env.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use paths::Utf8Path;
44
use rustc_hash::FxHashMap;
55
use toolchain::Tool;
66

7-
use crate::{utf8_stdout, CargoWorkspace, ManifestPath, PackageData, Sysroot, TargetKind};
7+
use crate::{utf8_stdout, ManifestPath, PackageData, Sysroot, TargetKind};
88

99
/// Recreates the compile-time environment variables that Cargo sets.
1010
///
@@ -51,23 +51,13 @@ pub(crate) fn inject_cargo_env(env: &mut Env) {
5151
env.set("CARGO", Tool::Cargo.path().to_string());
5252
}
5353

54-
pub(crate) fn inject_rustc_tool_env(
55-
env: &mut Env,
56-
cargo: &CargoWorkspace,
57-
cargo_name: &str,
58-
kind: TargetKind,
59-
) {
54+
pub(crate) fn inject_rustc_tool_env(env: &mut Env, cargo_name: &str, kind: TargetKind) {
6055
_ = kind;
6156
// FIXME
6257
// if kind.is_executable() {
6358
// env.set("CARGO_BIN_NAME", cargo_name);
6459
// }
6560
env.set("CARGO_CRATE_NAME", cargo_name.replace('-', "_"));
66-
// NOTE: Technically we should set this for all crates, but that will worsen the deduplication
67-
// logic so for now just keeping it proc-macros ought to be fine.
68-
if kind.is_proc_macro() {
69-
env.set("CARGO_RUSTC_CURRENT_DIR", cargo.manifest_path().parent().to_string());
70-
}
7161
}
7262

7363
pub(crate) fn cargo_config_env(

src/tools/rust-analyzer/crates/project-model/src/workspace.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1362,12 +1362,10 @@ fn add_target_crate_root(
13621362
let mut env = cargo.env().clone();
13631363
inject_cargo_package_env(&mut env, pkg);
13641364
inject_cargo_env(&mut env);
1365-
inject_rustc_tool_env(&mut env, cargo, cargo_name, kind);
1365+
inject_rustc_tool_env(&mut env, cargo_name, kind);
13661366

13671367
if let Some(envs) = build_data.map(|(it, _)| &it.envs) {
1368-
for (k, v) in envs {
1369-
env.set(k, v.clone());
1370-
}
1368+
env.extend_from_other(envs);
13711369
}
13721370
let crate_id = crate_graph.add_crate_root(
13731371
file_id,

0 commit comments

Comments
 (0)