Skip to content

Commit

Permalink
Auto merge of #13886 - jneem:vendoring-warning, r=arlosi
Browse files Browse the repository at this point in the history
Silence the warning about forgetting the vendoring
  • Loading branch information
bors committed Jun 4, 2024
2 parents 7034e2a + 2f97a3b commit 34a6a87
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cargo/sources/replaced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ impl<'gctx> Source for ReplacedSource<'gctx> {
}

fn is_replaced(&self) -> bool {
true
!self.is_builtin_replacement()
}

fn add_to_yanked_whitelist(&mut self, pkgs: &[PackageId]) {
Expand Down
2 changes: 2 additions & 0 deletions src/cargo/sources/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,8 @@ pub trait Source {
fn describe(&self) -> String;

/// Returns whether a source is being replaced by another here.
///
/// Builtin replacement of `crates.io` doesn't count as replacement here.
fn is_replaced(&self) -> bool {
false
}
Expand Down
40 changes: 40 additions & 0 deletions tests/testsuite/registry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3833,3 +3833,43 @@ fn builtin_source_replacement() {
)
.run();
}

#[cargo_test]
fn builtin_source_replacement_no_vendor_error() {
// errors for builtin source replacement of crates.io
// should not mention outdated vendor dependencies
let server = RegistryBuilder::new().build();

let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.1"
edition = "2021"
[dependencies]
dep = "0.2.0"
"#,
)
.file("src/main.rs", "fn main() {}")
.build();

let pkg = Package::new("dep", "0.1.0");
pkg.publish();

p.cargo("check -v")
.replace_crates_io(&server.index_url())
.with_status(101)
.with_stderr(
"\
[UPDATING] [..] index
[ERROR] failed to select a version for the requirement `dep = \"^0.2.0\"`
candidate versions found which didn't match: 0.1.0
location searched: crates.io index
required by package `foo v0.0.1 ([..])`
",
)
.run();
}

0 comments on commit 34a6a87

Please sign in to comment.