Skip to content

Commit

Permalink
Partially revert change to filter debug_assertions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Mar 5, 2020
1 parent 5fe8ab5 commit b8ab32e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/cargo/core/compiler/build_context/target_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ impl TargetInfo {

fn not_user_specific_cfg(cfg: &CargoResult<Cfg>) -> bool {
if let Ok(Cfg::Name(cfg_name)) = cfg {
if cfg_name == "debug_assertions" || cfg_name == "proc_macro" {
// This should also include "debug_assertions", but it causes
// regressions. Maybe some day in the distant future it can be
// added (and possibly change the warning to an error).
if cfg_name == "proc_macro" {
return false;
}
}
Expand Down
5 changes: 5 additions & 0 deletions src/cargo/core/compiler/custom_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,11 @@ fn build_work<'a, 'cfg>(cx: &mut Context<'a, 'cfg>, unit: &Unit<'a>) -> CargoRes
}
}
for (k, v) in cfg_map {
if k == "debug_assertions" {
// This cfg is always true and misleading, so avoid setting it.
// That is because Cargo queries rustc without any profile settings.
continue;
}
let k = format!("CARGO_CFG_{}", super::envify(&k));
match v {
Some(list) => {
Expand Down

0 comments on commit b8ab32e

Please sign in to comment.