Comments (3)
Haven't checked what is wrong, but here is the minimal repo in Cargo-flavored test code:
#[cargo_test]
fn git_downgrade_with_duplicate_packages() {
Package::new("rustc-hash", "1.1.0").publish();
Package::new("rustc-hash", "2.0.0").publish();
let (git_project, repo) = git::new_repo("pubgrub", |project| {
project
.file(
"Cargo.toml",
r#"
[package]
name = "pubgrub"
edition = "2021"
[dependencies]
rustc-hash = ">=1.0.0, <3.0.0"
"#,
)
.file("src/lib.rs", "")
});
let rev1 = repo.revparse_single("HEAD").unwrap().id();
let p = project()
.file(
"Cargo.toml",
&format!(
r#"
[package]
name = "foo"
[dependencies]
rustc-hash1 = {{ version = "1", package = "rustc-hash" }}
rustc-hash2 = {{ version = "2", package = "rustc-hash" }}
pubgrub = {{ git = "{}", rev = "{rev1}" }}
"#,
git_project.url(),
),
)
.file("src/lib.rs", "")
.build();
p.cargo("fetch").run();
assert_e2e().eq(p.read_lockfile(), str![[r##"
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "foo"
version = "0.0.0"
dependencies = [
"pubgrub",
"rustc-hash 1.1.0",
"rustc-hash 2.0.0",
]
[[package]]
name = "pubgrub"
version = "0.0.0"
source = "git+[ROOTURL]/pubgrub?rev=de416b2ad7717e09e79a34de70330a07c8b9a0fb#de416b2ad7717e09e79a34de70330a07c8b9a0fb"
dependencies = [
"rustc-hash 2.0.0",
]
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1981f6ee594df09828a9d95ce56ebac0ee354f40d684bec2f14bd3f4e54356a3"
[[package]]
name = "rustc-hash"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff208de0b08da920f89e127a4a0f70d2053783efc65d9e398907d1e127cda41"
"##]]);
git_project.change_file("src/lib.rs", "pub fn hello()");
git::add(&repo);
let rev2 = git::commit(&repo);
p.change_file(
"Cargo.toml",
&format!(
r#"
[package]
name = "foo"
[dependencies]
rustc-hash1 = {{ version = "1", package = "rustc-hash" }}
rustc-hash2 = {{ version = "2", package = "rustc-hash" }}
pubgrub = {{ git = "{}", rev = "{rev2}" }}
"#,
git_project.url(),
),
);
p.cargo("fetch").run();
assert_e2e().eq(p.read_lockfile(), str![[r##"
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "foo"
version = "0.0.0"
dependencies = [
"pubgrub",
"rustc-hash 1.1.0",
"rustc-hash 2.0.0",
]
[[package]]
name = "pubgrub"
version = "0.0.0"
source = "git+[ROOTURL]/pubgrub?rev=b5883bacc43c4055a9b1261f77f0c4dd9c2ceae3#b5883bacc43c4055a9b1261f77f0c4dd9c2ceae3"
dependencies = [
"rustc-hash 1.1.0",
]
[[package]]
name = "rustc-hash"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1981f6ee594df09828a9d95ce56ebac0ee354f40d684bec2f14bd3f4e54356a3"
[[package]]
name = "rustc-hash"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bff208de0b08da920f89e127a4a0f70d2053783efc65d9e398907d1e127cda41"
"##]]);
}
This seems to only happen with Git dependencies. Editing a registry dependency with a wide version requirement doesn't have the same buggy behavior.
from cargo.
I suspect this is similar to #5529. I don't remember the explanation why when there is a dependency range across multiple major semver versions that the resolver tends to downgrade to older versions.
from cargo.
I suspect this is related to #14115.
from cargo.
Related Issues (20)
- `cargo info` requires login HOT 9
- cargo does not see `Cargo.toml` if `.gitignore` contains `/*` HOT 16
- MSRV resolver has surprising behaviour in workspaces with mixed MSRV HOT 16
- Can't generate feature gated code from a proc macro in a reliable way when used by both normal/build dependencies with `resolver="2"` HOT 2
- trim-paths mixes forward and backslashes in backtrace when built on WIndows HOT 1
- Option for `cargo tree` to filter out (non-)workspace members HOT 2
- Tracking Issue for `--lockfile-path` HOT 1
- `cargo publish --dry-run` doesn't fail on invalid keywords HOT 3
- Ability to test against registry dependencies, instead of path dependencies HOT 1
- Introduce perma-unstable `--compile-time-deps` flag HOT 3
- `cargo test` produces `Too many open files` on NixOS when using multiple integration tests
- Report crates.io metrics in `cargo info` subcommand
- CI requires formatting, but the project doesn't specify which one HOT 2
- Unable to cargo build with custom source registry when no access to static.crates.io HOT 2
- Tell `rustc` wrappers which envs to pass through to allow env sandboxing HOT 3
- Anchor build returns the below error always HOT 2
- Build fails with "filename, directory name, or volume label syntax is incorrect" error in typenum crate HOT 1
- `cargo rustdoc` does not document lib tests HOT 2
- `cargo update -p $some_dependency` causes unexpected dependency downgrades HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cargo.