mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Apply environment set by build scripts
This commit is contained in:
parent
d6aa1ba7d4
commit
eeeacc4727
2 changed files with 20 additions and 2 deletions
|
@ -453,13 +453,18 @@ fn add_target_crate_root(
|
|||
opts.extend(pkg.cfgs.iter().cloned());
|
||||
opts
|
||||
};
|
||||
|
||||
let mut env = Env::default();
|
||||
for (k, v) in &pkg.envs {
|
||||
env.set(k, v.clone());
|
||||
}
|
||||
if let Some(out_dir) = &pkg.out_dir {
|
||||
// NOTE: cargo and rustc seem to hide non-UTF-8 strings from env! and option_env!()
|
||||
if let Some(out_dir) = out_dir.to_str().map(|s| s.to_owned()) {
|
||||
env.set("OUT_DIR", out_dir);
|
||||
}
|
||||
}
|
||||
|
||||
let proc_macro =
|
||||
pkg.proc_macro_dylib_path.as_ref().map(|it| proc_macro_loader(&it)).unwrap_or_default();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue