Skip to content

having some sort of semver for git dependencies #6961

@elichai

Description

@elichai

If 2 crates import a dependency from git and it's even a bit different cargo treats them as 2 unrelated crates.

let's say crate A has this toml:

[package]
name = "a"
version = "0.0.1"

[dependencies]
serde = { git = "https://github.com/serde-rs/serde.git", features = ["serde_derive"] }

and contains this struct: #[derive(Serialize)] struct Arr([u8; 32])

crate B has this toml:

[package]
name = "b"
version = "0.0.1"

[dependencies]
a = { path = "../a" }
serde = { git = "https://github.com/serde-rs/serde.git", rev = "fd9d334", features = ["serde_derive"] }

and contains this:

use a::Arr;
#[derive(Serialize)] 
struct BetterArr(Arr)

This will complain that Arr doesn't implement Serialize.
even though technically they point to the exact same thing.
and even if they're not pointing to the same thing I would've hoped there would be a way for me to do something similar to crate = "=1.0.1" and lock to an exact revision/tag/branch.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-gitArea: anything dealing with gitC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-needs-rfcStatus: Needs an RFC to make progress.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions