mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 21:05:02 +00:00
Set debug_assertions and miri cfgs as config defaults, allowing them to be overwritten
This commit is contained in:
parent
8989dcffd6
commit
0485a85ee2
6 changed files with 35 additions and 14 deletions
|
@ -1,3 +1,4 @@
|
|||
//! Cargo-like environment variables injection.
|
||||
use base_db::Env;
|
||||
use rustc_hash::FxHashMap;
|
||||
use toolchain::Tool;
|
||||
|
|
|
@ -32,9 +32,6 @@ pub(crate) fn get(
|
|||
}
|
||||
}
|
||||
|
||||
// Add miri cfg, which is useful for mir eval in stdlib
|
||||
res.push(CfgFlag::Atom("miri".into()));
|
||||
|
||||
let rustc_cfgs = get_rust_cfgs(target, extra_env, config);
|
||||
|
||||
let rustc_cfgs = match rustc_cfgs {
|
||||
|
|
|
@ -1454,8 +1454,14 @@ fn sysroot_to_crate_graph(
|
|||
None,
|
||||
rustc_cfg,
|
||||
&CfgOverrides {
|
||||
global: CfgDiff::new(vec![CfgAtom::Flag("debug_assertions".into())], vec![])
|
||||
.unwrap(),
|
||||
global: CfgDiff::new(
|
||||
vec![
|
||||
CfgAtom::Flag("debug_assertions".into()),
|
||||
CfgAtom::Flag("miri".into()),
|
||||
],
|
||||
vec![],
|
||||
)
|
||||
.unwrap(),
|
||||
..Default::default()
|
||||
},
|
||||
&WorkspaceBuildScripts::default(),
|
||||
|
@ -1519,6 +1525,7 @@ fn sysroot_to_crate_graph(
|
|||
let mut cfg_options = CfgOptions::default();
|
||||
cfg_options.extend(rustc_cfg);
|
||||
cfg_options.insert_atom("debug_assertions".into());
|
||||
cfg_options.insert_atom("miri".into());
|
||||
cfg_options
|
||||
});
|
||||
let sysroot_crates: FxHashMap<SysrootCrate, CrateId> = stitched
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue