Skip to content

Commit afe7314

Browse files
committed
Don't trigger an update when looking for suggestions.
1 parent a93bfcb commit afe7314

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/cargo/core/compiler/future_incompat.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,7 @@ fn render_suggestions(
245245
let mut sources: HashMap<_, _> = source_ids
246246
.into_iter()
247247
.filter_map(|sid| {
248-
let unlocked = sid.clone().with_precise(None);
249-
let mut source = map.load(unlocked, &HashSet::new()).ok()?;
250-
// Ignore errors updating.
251-
if let Err(e) = source.update() {
252-
log::debug!("failed to update source: {:?}", e);
253-
}
248+
let source = map.load(sid, &HashSet::new()).ok()?;
254249
Some((sid, source))
255250
})
256251
.collect();

tests/testsuite/future_incompat_report.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,15 @@ fn suggestions_for_updates() {
325325
.file("src/lib.rs", "")
326326
.publish();
327327

328+
// This is a hack to force cargo to update the index. Cargo can't do this
329+
// automatically because doing a network update on every build would be a
330+
// bad idea. Under normal circumstances, we'll hope the user has done
331+
// something else along the way to trigger an update (building some other
332+
// project or something). This could use some more consideration of how to
333+
// handle this better (maybe only trigger an update if it hasn't updated
334+
// in a long while?).
335+
p.cargo("update -p without_updates").run();
336+
328337
p.cargo("check -Zfuture-incompat-report")
329338
.masquerade_as_nightly_cargo()
330339
.with_stderr_contains("[..]cargo report future-incompatibilities --id 1[..]")

0 commit comments

Comments
 (0)