Skip to content

Commit

Permalink
Don't trigger an update when looking for suggestions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehuss committed Jun 21, 2021
1 parent a93bfcb commit afe7314
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 1 addition & 6 deletions src/cargo/core/compiler/future_incompat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,7 @@ fn render_suggestions(
let mut sources: HashMap<_, _> = source_ids
.into_iter()
.filter_map(|sid| {
let unlocked = sid.clone().with_precise(None);
let mut source = map.load(unlocked, &HashSet::new()).ok()?;
// Ignore errors updating.
if let Err(e) = source.update() {
log::debug!("failed to update source: {:?}", e);
}
let source = map.load(sid, &HashSet::new()).ok()?;
Some((sid, source))
})
.collect();
Expand Down
9 changes: 9 additions & 0 deletions tests/testsuite/future_incompat_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,15 @@ fn suggestions_for_updates() {
.file("src/lib.rs", "")
.publish();

// This is a hack to force cargo to update the index. Cargo can't do this
// automatically because doing a network update on every build would be a
// bad idea. Under normal circumstances, we'll hope the user has done
// something else along the way to trigger an update (building some other
// project or something). This could use some more consideration of how to
// handle this better (maybe only trigger an update if it hasn't updated
// in a long while?).
p.cargo("update -p without_updates").run();

p.cargo("check -Zfuture-incompat-report")
.masquerade_as_nightly_cargo()
.with_stderr_contains("[..]cargo report future-incompatibilities --id 1[..]")
Expand Down

0 comments on commit afe7314

Please sign in to comment.