Skip to content

Cannot use borsh feature in crates that depend on borsh-derive #383

Closed
@preston-evans98

Description

@preston-evans98

Since at least version 1.2, borsh transitively depends on indexmap via toml_edit if the borsh/derive feature is activated. This causes builds to fail with a circular dependency error when using indexmap/borsh and borsh/derive in the same crate.

[package]
name = "example"
version = "0.1.0"
edition = "2021"
resolver = "2"


[dependencies]
borsh = { version = "1", features = ["derive"] }
indexmap = { version = "2.8.0", features = ["borsh"] }
$ cargo check
error: cyclic package dependency: package `borsh v1.5.1` depends on itself. Cycle:
package `borsh v1.5.1`
    ... which satisfies dependency `borsh = "^1.2"` (locked to 1.5.1) of package `indexmap v2.8.0`
    ... which satisfies dependency `indexmap = "^2.3.0"` (locked to 2.8.0) of package `toml_edit v0.22.24`
    ... which satisfies dependency `toml_edit = "^0.22.24"` of package `proc-macro-crate v3.3.0`
    ... which satisfies dependency `proc-macro-crate = "^3"` of package `borsh-derive v1.5.5`
    ... which satisfies dependency `borsh-derive = "~1.5.1"` of package `borsh v1.5.1`

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