Skip to content

Commit e4842f2

Browse files
borsehuss
authored andcommitted
Auto merge of rust-lang#13438 - Urgau:check-cfg-msrv-annoyance, r=ehuss
Silently ignore `cargo::rustc-check-cfg` to avoid MSRV annoyance when stabilizing `-Zcheck-cfg` This PR, removes the warning when trying to use `cargo::rustc-check-cfg` on stable or nightly (without the nightly-only `-Zcheck-cfg` flag) to avoid MSRV annoyance when stabilizing `-Zcheck-cfg`. See this [Zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/check-cfg.20backwards.20compatible.20warnings) for more information and context. cc `@ehuss`
1 parent 837c09f commit e4842f2

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

src/cargo/core/compiler/custom_build.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -915,10 +915,8 @@ impl BuildOutput {
915915
if extra_check_cfg {
916916
check_cfgs.push(value.to_string());
917917
} else {
918-
warnings.push(format!(
919-
"{}{} requires -Zcheck-cfg flag",
920-
syntax_prefix, key
921-
));
918+
// silently ignoring the instruction to try to
919+
// minimise MSRV annoyance when stabilizing -Zcheck-cfg
922920
}
923921
}
924922
"rustc-env" => {

src/cargo/util/config/target.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -207,10 +207,8 @@ fn parse_links_overrides(
207207
let list = value.list(key)?;
208208
output.check_cfgs.extend(list.iter().map(|v| v.0.clone()));
209209
} else {
210-
config.shell().warn(format!(
211-
"target config `{}.{}` requires -Zcheck-cfg flag",
212-
target_key, key
213-
))?;
210+
// silently ignoring the instruction to try to
211+
// minimise MSRV annoyance when stabilizing -Zcheck-cfg
214212
}
215213
}
216214
"rustc-env" => {

tests/testsuite/check_cfg.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,7 @@ fn build_script_override_feature_gate() {
456456
.build();
457457

458458
p.cargo("check")
459-
.with_stderr_contains(
460-
"warning: target config[..]rustc-check-cfg[..] requires -Zcheck-cfg flag",
461-
)
459+
.with_stderr_does_not_contain("warning: [..]rustc-check-cfg[..]")
462460
.run();
463461
}
464462

@@ -540,7 +538,7 @@ fn build_script_feature_gate() {
540538
.build();
541539

542540
p.cargo("check")
543-
.with_stderr_contains("warning[..]cargo::rustc-check-cfg requires -Zcheck-cfg flag")
541+
.with_stderr_does_not_contain("warning: [..]rustc-check-cfg[..]")
544542
.with_status(0)
545543
.run();
546544
}

0 commit comments

Comments
 (0)