Skip to content

Allow cyclic dependencies between dependency graphs where possible (coming from the new resolver) #8734

@mehcode

Description

@mehcode

Describe the problem you are trying to solve

Given two crates foo and foo-macro, where foo-macro has a dependency on foo, foo should be able to optionally depend on foo-macro via a cargo feature (as long as foo-macro does not activate the feature).

Describe the solution you'd like

See above.

Notes

With the new v2 dependency resolver (amazing stuff by the way, this solves a lot of other various wrinkles I've stumbled across), it feels like this should be fairly straight forward to solve for someone familiar with the cargo internals. My guess would be the checker for cyclic dependencies simply now has false positives and adjusting the check to recognize the above scenarios would simply work.


For a more concrete use case, SQLx currently has three primary crates: sqlx, sqlx-core, and sqlx-macros. All the sqlx crate does is forward everything from sqlx-core and sqlx-macros into a single crate. sqlx-macros needs to use sqlx-core. This feature request would remove the need to have the sqlx-core crate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-dependency-resolutionArea: dependency resolution and the resolverC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`S-propose-closeStatus: A team member has nominated this for closing, pending further input from the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions