-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 #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 #9073
- Loading branch information
1 parent
a73e5b7
commit 4b4dc0a
Showing
2 changed files
with
101 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters