Skip to content

Commit

Permalink
Emit note when --future-incompat-report had nothing to report
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron1011 committed Mar 15, 2021
1 parent 32da9ea commit f9512ff
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/cargo/core/compiler/job_queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -807,9 +807,16 @@ impl<'cfg> DrainState<'cfg> {
}

fn emit_future_incompat(&mut self, cx: &mut Context<'_, '_>) {
if cx.bcx.config.cli_unstable().enable_future_incompat_feature
&& !self.per_crate_future_incompat_reports.is_empty()
{
if cx.bcx.config.cli_unstable().enable_future_incompat_feature {
if self.per_crate_future_incompat_reports.is_empty() {
drop(
cx.bcx
.config
.shell()
.note("0 dependencies had future-incompat warnings"),
);
return;
}
self.per_crate_future_incompat_reports
.sort_by_key(|r| r.package_id);

Expand Down
17 changes: 17 additions & 0 deletions tests/testsuite/future_incompat_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,23 @@ fn gate_future_incompat_report() {
.run();
}

#[cargo_test]
fn test_zero_future_incompat() {
if !is_nightly() {
return;
}

let p = project()
.file("Cargo.toml", &basic_manifest("foo", "0.0.0"))
.file("src/main.rs", "fn main() {}")
.build();

p.cargo("build --future-incompat-report -Z unstable-options -Z future-incompat-report")
.masquerade_as_nightly_cargo()
.with_stderr_contains("note: 0 dependencies had future-incompat warnings")
.run();
}

#[cargo_test]
fn test_single_crate() {
if !is_nightly() {
Expand Down

0 comments on commit f9512ff

Please sign in to comment.