diff --git a/src/cargo/core/source/source_id.rs b/src/cargo/core/source/source_id.rs index 20b27577eeb..dd5f5ff9af5 100644 --- a/src/cargo/core/source/source_id.rs +++ b/src/cargo/core/source/source_id.rs @@ -283,7 +283,12 @@ impl SourceId { Ok(p) => p, Err(()) => panic!("path sources cannot be remote"), }; - Ok(Box::new(RegistrySource::local(self, &path, config))) + Ok(Box::new(RegistrySource::local( + self, + &path, + yanked_whitelist, + config, + ))) } Kind::Directory => { let path = match self.inner.url.to_file_path() { diff --git a/src/cargo/sources/registry/mod.rs b/src/cargo/sources/registry/mod.rs index a496e2f6dd9..86dd6f2cf89 100644 --- a/src/cargo/sources/registry/mod.rs +++ b/src/cargo/sources/registry/mod.rs @@ -404,7 +404,12 @@ impl<'cfg> RegistrySource<'cfg> { ) } - pub fn local(source_id: SourceId, path: &Path, config: &'cfg Config) -> RegistrySource<'cfg> { + pub fn local( + source_id: SourceId, + path: &Path, + yanked_whitelist: &HashSet, + config: &'cfg Config, + ) -> RegistrySource<'cfg> { let name = short_name(source_id); let ops = local::LocalRegistry::new(path, config, &name); RegistrySource::new( @@ -412,7 +417,7 @@ impl<'cfg> RegistrySource<'cfg> { config, &name, Box::new(ops), - &HashSet::new(), + yanked_whitelist, false, ) } diff --git a/tests/testsuite/doc.rs b/tests/testsuite/doc.rs index 502413de71c..b073a070c82 100644 --- a/tests/testsuite/doc.rs +++ b/tests/testsuite/doc.rs @@ -1372,7 +1372,7 @@ fn doc_message_format() { p.cargo("doc --message-format=json") .with_status(101) - .with_json( + .with_json_contains_unordered( r#" { "message": { @@ -1402,10 +1402,7 @@ fn short_message_format() { p.cargo("doc --message-format=short") .with_status(101) .with_stderr_contains( - "\ -src/lib.rs:4:6: error: `[bad_link]` cannot be resolved, ignoring it... -error: Could not document `foo`. -", + "src/lib.rs:4:6: error: `[bad_link]` cannot be resolved, ignoring it...", ) .run(); } diff --git a/tests/testsuite/local_registry.rs b/tests/testsuite/local_registry.rs index ab788d4c9bc..ce6a40c8f00 100644 --- a/tests/testsuite/local_registry.rs +++ b/tests/testsuite/local_registry.rs @@ -2,7 +2,7 @@ use std::fs::{self, File}; use std::io::prelude::*; use crate::support::paths::{self, CargoPathExt}; -use crate::support::registry::Package; +use crate::support::registry::{registry_path, Package}; use crate::support::{basic_manifest, project}; fn setup() { @@ -61,6 +61,45 @@ fn simple() { p.cargo("test").run(); } +#[test] +fn depend_on_yanked() { + setup(); + Package::new("bar", "0.0.1").local(true).publish(); + + let p = project() + .file( + "Cargo.toml", + r#" + [project] + name = "foo" + version = "0.0.1" + authors = [] + + [dependencies] + bar = "0.0.1" + "#, + ) + .file("src/lib.rs", "") + .build(); + + // Run cargo to create lock file. + p.cargo("check").run(); + + registry_path().join("index").join("3").rm_rf(); + Package::new("bar", "0.0.1") + .local(true) + .yanked(true) + .publish(); + + p.cargo("check") + .with_stderr( + "\ +[FINISHED] [..] +", + ) + .run(); +} + #[test] fn multiple_versions() { setup();