Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in Cargo's cyclic dep graph detection #9075

Merged
merged 1 commit into from
Jan 18, 2021

Commits on Jan 14, 2021

  1. Fix a bug in Cargo's cyclic dep graph detection

    Cargo's cyclic dependency graph detection turns out to have had a bug
    for quite a long time as surfaced by rust-lang#9073. The bug in Cargo has to do
    with how dev-dependencies are handled. Cycles are "allowed" through
    dev-dependencies because the dev-dependency can depend on the original
    crate. Our cyclic graph detection, however, was too eagerly flagging a
    package as known to not have a cycle before we had processed everything
    about it.
    
    The fix here was basically to just simplify the graph traversal. Instead
    of traversing the raw `Resolve` this instead creates an alternate
    in-memory graph which has the actual edges we care about for cycle
    detection (e.g. every edge that wasn't induced via a dev-dependency).
    With this simplified graph we then apply the exact same algorithm, but
    this time it should be less buggy because we're not trying to do funky
    things about switching sets about what's visited halfway through a
    traversal.
    
    Closes rust-lang#9073
    alexcrichton committed Jan 14, 2021
    Configuration menu
    Copy the full SHA
    4b4dc0a View commit details
    Browse the repository at this point in the history