|
1 | 1 | use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
|
2 | 2 | use std::path::{Path, PathBuf};
|
3 | 3 | use std::sync::Arc;
|
| 4 | +use std::task::Poll; |
4 | 5 | use std::{env, fs};
|
5 | 6 |
|
6 | 7 | use crate::core::compiler::{CompileKind, DefaultExecutor, Executor, Freshness, UnitOutput};
|
@@ -530,22 +531,40 @@ impl<'cfg, 'a> InstallablePackage<'cfg, 'a> {
|
530 | 531 | // duplicate "Updating", but since `source` is taken by value, then it
|
531 | 532 | // wouldn't be available for `compile_ws`.
|
532 | 533 | let (pkg_set, resolve) = ops::resolve_ws(&self.ws)?;
|
533 |
| - let mut sources = pkg_set.sources_mut(); |
534 | 534 |
|
535 | 535 | // Checking the yanked status involves taking a look at the registry and
|
536 | 536 | // maybe updating files, so be sure to lock it here.
|
537 | 537 | let _lock = self.ws.config().acquire_package_cache_lock()?;
|
538 | 538 |
|
539 |
| - for pkg_id in resolve.iter() { |
540 |
| - if let Some(source) = sources.get_mut(pkg_id.source_id()) { |
541 |
| - if source.is_yanked(pkg_id)? { |
542 |
| - self.ws.config().shell().warn(format!( |
543 |
| - "package `{}` in Cargo.lock is yanked in registry `{}`, \ |
544 |
| - consider running without --locked", |
545 |
| - pkg_id, |
546 |
| - pkg_id.source_id().display_registry_name() |
547 |
| - ))?; |
| 539 | + let mut sources = pkg_set.sources_mut(); |
| 540 | + let mut pending: Vec<PackageId> = resolve.iter().collect(); |
| 541 | + let mut results = Vec::new(); |
| 542 | + for (_id, source) in sources.sources_mut() { |
| 543 | + source.invalidate_cache(); |
| 544 | + } |
| 545 | + while !pending.is_empty() { |
| 546 | + pending.retain(|pkg_id| { |
| 547 | + if let Some(source) = sources.get_mut(pkg_id.source_id()) { |
| 548 | + match source.is_yanked(*pkg_id) { |
| 549 | + Poll::Ready(result) => results.push((*pkg_id, result)), |
| 550 | + Poll::Pending => return true, |
| 551 | + } |
548 | 552 | }
|
| 553 | + false |
| 554 | + }); |
| 555 | + for (_id, source) in sources.sources_mut() { |
| 556 | + source.block_until_ready()?; |
| 557 | + } |
| 558 | + } |
| 559 | + |
| 560 | + for (pkg_id, is_yanked) in results { |
| 561 | + if is_yanked? { |
| 562 | + self.ws.config().shell().warn(format!( |
| 563 | + "package `{}` in Cargo.lock is yanked in registry `{}`, \ |
| 564 | + consider running without --locked", |
| 565 | + pkg_id, |
| 566 | + pkg_id.source_id().display_registry_name() |
| 567 | + ))?; |
549 | 568 | }
|
550 | 569 | }
|
551 | 570 |
|
|
0 commit comments