Skip to content

Commit f9512ff

Browse files
committed
Emit note when --future-incompat-report had nothing to report
1 parent 32da9ea commit f9512ff

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

src/cargo/core/compiler/job_queue.rs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -807,9 +807,16 @@ impl<'cfg> DrainState<'cfg> {
807807
}
808808

809809
fn emit_future_incompat(&mut self, cx: &mut Context<'_, '_>) {
810-
if cx.bcx.config.cli_unstable().enable_future_incompat_feature
811-
&& !self.per_crate_future_incompat_reports.is_empty()
812-
{
810+
if cx.bcx.config.cli_unstable().enable_future_incompat_feature {
811+
if self.per_crate_future_incompat_reports.is_empty() {
812+
drop(
813+
cx.bcx
814+
.config
815+
.shell()
816+
.note("0 dependencies had future-incompat warnings"),
817+
);
818+
return;
819+
}
813820
self.per_crate_future_incompat_reports
814821
.sort_by_key(|r| r.package_id);
815822

tests/testsuite/future_incompat_report.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,23 @@ fn gate_future_incompat_report() {
5151
.run();
5252
}
5353

54+
#[cargo_test]
55+
fn test_zero_future_incompat() {
56+
if !is_nightly() {
57+
return;
58+
}
59+
60+
let p = project()
61+
.file("Cargo.toml", &basic_manifest("foo", "0.0.0"))
62+
.file("src/main.rs", "fn main() {}")
63+
.build();
64+
65+
p.cargo("build --future-incompat-report -Z unstable-options -Z future-incompat-report")
66+
.masquerade_as_nightly_cargo()
67+
.with_stderr_contains("note: 0 dependencies had future-incompat warnings")
68+
.run();
69+
}
70+
5471
#[cargo_test]
5572
fn test_single_crate() {
5673
if !is_nightly() {

0 commit comments

Comments
 (0)