mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-25 11:14:46 +00:00
remove all residual state from previous lock files
This commit is contained in:
parent
8418a3ae58
commit
61e592788c
@ -195,6 +195,12 @@ impl<'cfg> PackageRegistry<'cfg> {
|
||||
self.yanked_whitelist.extend(pkgs);
|
||||
}
|
||||
|
||||
/// remove all residual state from previous lock files.
|
||||
pub fn clear_lock(&mut self) {
|
||||
trace!("clear_lock");
|
||||
self.locked = HashMap::new();
|
||||
}
|
||||
|
||||
pub fn register_lock(&mut self, id: PackageId, deps: Vec<PackageId>) {
|
||||
trace!("register_lock: {}", id);
|
||||
for dep in deps.iter() {
|
||||
|
@ -584,6 +584,7 @@ fn register_previous_locks(
|
||||
// the registry as a locked dependency.
|
||||
let keep = |id: &PackageId| keep(id) && !avoid_locking.contains(id);
|
||||
|
||||
registry.clear_lock();
|
||||
for node in resolve.iter().filter(keep) {
|
||||
let deps = resolve
|
||||
.deps_not_replaced(node)
|
||||
|
@ -4934,6 +4934,7 @@ use cargo_test_support::registry::Dependency;
|
||||
|
||||
#[cargo_test]
|
||||
fn reduced_reproduction_8249() {
|
||||
// https://github.com/rust-lang/cargo/issues/8249
|
||||
Package::new("a-src", "0.1.0").links("a").publish();
|
||||
Package::new("a-src", "0.2.0").links("a").publish();
|
||||
|
||||
@ -4966,10 +4967,6 @@ fn reduced_reproduction_8249() {
|
||||
|
||||
p.cargo("generate-lockfile").run();
|
||||
cargo::util::paths::append(&p.root().join("Cargo.toml"), b"c = \"*\"").unwrap();
|
||||
p.cargo("check")
|
||||
.with_status(101)
|
||||
.with_stderr_contains("[..]links to the native library `a`[..]")
|
||||
.run();
|
||||
// This passes, what!?
|
||||
p.cargo("check").run();
|
||||
p.cargo("check").run();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user