You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Auto merge of #14089 - Eh2406:check_cycles, r=weihanglo
Simplify checking for dependency cycles
### What does this PR try to resolve?
In my PubGrub work I had to try to understand the `check_cycles` post resolution pass. I found the code tricky to understand and doing some unnecessary reallocations. I cleaned up the code to remove the unnecessary data structures so that I could better understand.
### How should we test and review this PR?
It's an internal re-factor, and the tests still pass. But this code is not extensively tested by our test suite. In addition I ran my "resolve every crate on crates.io" script against a local check out of this branch. With the old code as `check_cycles_old` and the PR code as `check_cycles_new` the following assertion did not hit:
```rust
fn check_cycles(resolve: &Resolve) -> CargoResult<()> {
let old = check_cycles_old(resolve);
let new = check_cycles_new(resolve);
assert_eq!(old.is_err(), new.is_err());
old
}
```
That experiment also demonstrated that this was not a significant performance change in either direction.
### Additional information
If you're having questions about this code while you're reviewing, this would be a perfect opportunity for better naming and comments. Please ask questions.
0 commit comments