Skip to content

Commit a6230e3

Browse files
committed
refactor: start workspace preload earlier before patching
This is a preparation for patch re-resolving.
1 parent f6d8f9c commit a6230e3

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/cargo/ops/resolve.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,16 @@ pub fn resolve_with_previous<'gctx>(
327327
.gctx()
328328
.acquire_package_cache_lock(CacheLockMode::DownloadExclusive)?;
329329

330+
// Some packages are already loaded when setting up a workspace. This
331+
// makes it so anything that was already loaded will not be loaded again.
332+
// Without this there were cases where members would be parsed multiple times
333+
ws.preload(registry);
334+
335+
// In case any members were not already loaded or the Workspace is_ephemeral.
336+
for member in ws.members() {
337+
registry.add_sources(Some(member.package_id().source_id()))?;
338+
}
339+
330340
// Try to keep all from previous resolve if no instruction given.
331341
let keep_previous = keep_previous.unwrap_or(&|_| true);
332342

@@ -377,16 +387,6 @@ pub fn resolve_with_previous<'gctx>(
377387
registry.lock_patches();
378388
}
379389

380-
// Some packages are already loaded when setting up a workspace. This
381-
// makes it so anything that was already loaded will not be loaded again.
382-
// Without this there were cases where members would be parsed multiple times
383-
ws.preload(registry);
384-
385-
// In case any members were not already loaded or the Workspace is_ephemeral.
386-
for member in ws.members() {
387-
registry.add_sources(Some(member.package_id().source_id()))?;
388-
}
389-
390390
let summaries: Vec<(Summary, ResolveOpts)> = ws
391391
.members_with_features(specs, cli_features)?
392392
.into_iter()

0 commit comments

Comments
 (0)