mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Remove CARGO_RUSTC_CURRENT_DIR
This commit is contained in:
parent
dcee5fd71f
commit
c46e9c48b0
@ -4,7 +4,7 @@ use paths::Utf8Path;
|
|||||||
use rustc_hash::FxHashMap;
|
use rustc_hash::FxHashMap;
|
||||||
use toolchain::Tool;
|
use toolchain::Tool;
|
||||||
|
|
||||||
use crate::{utf8_stdout, CargoWorkspace, ManifestPath, PackageData, Sysroot, TargetKind};
|
use crate::{utf8_stdout, ManifestPath, PackageData, Sysroot, TargetKind};
|
||||||
|
|
||||||
/// Recreates the compile-time environment variables that Cargo sets.
|
/// Recreates the compile-time environment variables that Cargo sets.
|
||||||
///
|
///
|
||||||
@ -51,23 +51,13 @@ pub(crate) fn inject_cargo_env(env: &mut Env) {
|
|||||||
env.set("CARGO", Tool::Cargo.path().to_string());
|
env.set("CARGO", Tool::Cargo.path().to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn inject_rustc_tool_env(
|
pub(crate) fn inject_rustc_tool_env(env: &mut Env, cargo_name: &str, kind: TargetKind) {
|
||||||
env: &mut Env,
|
|
||||||
cargo: &CargoWorkspace,
|
|
||||||
cargo_name: &str,
|
|
||||||
kind: TargetKind,
|
|
||||||
) {
|
|
||||||
_ = kind;
|
_ = kind;
|
||||||
// FIXME
|
// FIXME
|
||||||
// if kind.is_executable() {
|
// if kind.is_executable() {
|
||||||
// env.set("CARGO_BIN_NAME", cargo_name);
|
// env.set("CARGO_BIN_NAME", cargo_name);
|
||||||
// }
|
// }
|
||||||
env.set("CARGO_CRATE_NAME", cargo_name.replace('-', "_"));
|
env.set("CARGO_CRATE_NAME", cargo_name.replace('-', "_"));
|
||||||
// NOTE: Technically we should set this for all crates, but that will worsen the deduplication
|
|
||||||
// logic so for now just keeping it proc-macros ought to be fine.
|
|
||||||
if kind.is_proc_macro() {
|
|
||||||
env.set("CARGO_RUSTC_CURRENT_DIR", cargo.manifest_path().parent().to_string());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn cargo_config_env(
|
pub(crate) fn cargo_config_env(
|
||||||
|
@ -1362,12 +1362,10 @@ fn add_target_crate_root(
|
|||||||
let mut env = cargo.env().clone();
|
let mut env = cargo.env().clone();
|
||||||
inject_cargo_package_env(&mut env, pkg);
|
inject_cargo_package_env(&mut env, pkg);
|
||||||
inject_cargo_env(&mut env);
|
inject_cargo_env(&mut env);
|
||||||
inject_rustc_tool_env(&mut env, cargo, cargo_name, kind);
|
inject_rustc_tool_env(&mut env, cargo_name, kind);
|
||||||
|
|
||||||
if let Some(envs) = build_data.map(|(it, _)| &it.envs) {
|
if let Some(envs) = build_data.map(|(it, _)| &it.envs) {
|
||||||
for (k, v) in envs {
|
env.extend_from_other(envs);
|
||||||
env.set(k, v.clone());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
let crate_id = crate_graph.add_crate_root(
|
let crate_id = crate_graph.add_crate_root(
|
||||||
file_id,
|
file_id,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user