Skip to content

Moving repository to a virtual manifest can cause surprising dependency resolution errors due to resolver fallback #11811

Closed as not planned
@thomaseizinger

Description

@thomaseizinger

I am not entirely sure this is a bug report or a feature request but I'll describe anyway what happened.

We have a fairly large workspace over at https://github.com/libp2p/rust-libp2p. Previously, the root Cargo.toml was both a crate and a workspace manifest. For various reasons, I wanted to move away from that.

That root crate is edition = 2021 which implies the new dependency resolver (version 2). Thus, we did not specify resolver = 2 explicitly as part of the [workspace] table. We need the new feature resolver because we have some target-specific features to activiate:

https://github.com/libp2p/rust-libp2p/blob/7069d78ee333c92a3b99bbad100d9c6ba2fe361a/transports/noise/Cargo.toml#L26-L30

What happened now is that by splitting the root manifest into a separate crate, the edition = 2021 disappeared and cargo was now falling back using v1 of the resolver, resulting in a failing build because the features of the snow dependency within the Cargo.toml of libp2p-noise were incorrectly merged.

This was especially surprising because I was running cargo build --package libp2p which does have edition = 2021. I guess this could be considered a bug? I am not sure.

The problem was fixed by explicitly specifying resolver = 2 in the [workspace] table.

Here is the PR: libp2p/rust-libp2p#3536

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