Skip to content

Commit

Permalink
Auto merge of rust-lang#9263 - Aaron1011:zero-incompat-note, r=ehuss
Browse files Browse the repository at this point in the history
Emit note when `--future-incompat-report` had nothing to report
  • Loading branch information
bors committed Mar 22, 2021
2 parents 4751e5c + f9512ff commit 58a9613
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 @@ -808,9 +808,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 58a9613

Please sign in to comment.