Skip to content

Crate hash loading from Cargo.lock is broken in Rust 1.77 #340

@pacak

Description

@pacak

rust-lang/cargo#12914 changed how package ID looks like, now it's something like this:

-"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)"
+"https://github.com/rust-lang/crates.io-index#[email protected]"

This changed how PackageId is represented:
https://docs.rs/cargo_metadata/latest/cargo_metadata/struct.PackageId.html

It is possible to inspect the repr field, if the need arises, but its precise format is an implementation detail and is subject to change.

At the same time lock.rs creates them from parts:

repr: format!("{} {} ({})", name, version, source),

As a result mapping between "shortened" and "full" ids breaks, and it fails to find any hashes. It's not the end of the world - crate2nix can fetch crates on it's own and place them in a file, but this is very slow if you have a lot of them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions