Add some documentation to the resolver #5195
Conversation
|
r? @matklad (rust_highfive has picked a reviewer for you, use r? to override) |
src/cargo/core/resolver/mod.rs
Outdated
There was a problem hiding this comment.
This part I was a little confused about given that we also modify the past_conflicting_activations above, and before merging I'd like to incorporate #5168 (comment) into the comment on this if statement
matklad
left a comment
There was a problem hiding this comment.
❤️
Looks great to me, modulo a couple of typos. However, as I don't really understand deeply how resolve works, it will take me large amount of time to actually verify that comments accurately describe the thing the code is doing, so
@bors r=Eh2406
src/cargo/core/resolver/mod.rs
Outdated
There was a problem hiding this comment.
Maybe change ::failure::Error to CargoError as well? They are one:
pub use failure::Error as CargoError;
src/cargo/core/resolver/mod.rs
Outdated
src/cargo/core/resolver/mod.rs
Outdated
src/cargo/core/resolver/mod.rs
Outdated
There was a problem hiding this comment.
We know we are going to fail all the way to the user: if just_here_for_the_error_messages and
yet we have another thing to try: has_another so if we try this it won't make it all the way to the user. Insted it will fail and bactrak to us to try the next candidate. So let's just skip to the next candidate.
There was a problem hiding this comment.
Aha that definitely makes sense!
Put another way, if just_here_for_the_error_messages is true, we basically want to exhaust the iterator immediately to collect the HashMap it spits out as to why we filtered out candidates?
There was a problem hiding this comment.
Sort of. If just_here_for_the_error_messages then we ether want to
- Exhaust the iterator immediately (as you said) so this dep can bactrack to the users.
- Activate the last candidate so one of our dependencies can bactrack to the users.
There was a problem hiding this comment.
Oh hm I'm not sure I understand then. For that second condition where we want to activate the last candidate so we can backtrack, how come the last candidate is special? Is that because it's the only one which'll force a backtrack if it fails?
There was a problem hiding this comment.
Yes? It is the only one that does not add a backtrack frame for our children to come back to. And we could just pick the first one and not add a backtrack frame, but then the error message will be different.
Befor: ... which is depended on by `bar v0.1.0`
After: ... which is depended on by `bar v0.1.99`
|
I have been reading the comments and they look great to me so far! I got up to |
Eh2406
left a comment
There was a problem hiding this comment.
Overall looks like a lot of improvement.
src/cargo/core/resolver/mod.rs
Outdated
There was a problem hiding this comment.
We know we are going to fail all the way to the user: if just_here_for_the_error_messages and
yet we have another thing to try: has_another so if we try this it won't make it all the way to the user. Insted it will fail and bactrak to us to try the next candidate. So let's just skip to the next candidate.
src/cargo/core/resolver/mod.rs
Outdated
There was a problem hiding this comment.
I miss read this as meaning past_conflicting_activations instead of conflicting_activations
src/cargo/core/resolver/mod.rs
Outdated
There was a problem hiding this comment.
This is better than what I had, by a lot, but I wonder if it could be clearer. Semse like a lot of interacting clauses in the last sentence. What is in this case modifying?
Maybe:
If a dependency is known to fail we want to skip this frame as this is surely a dead end. If there are more candidates then we can skip this frame without affecting error messages. However, if this is last candidate we activate to get its error message.
src/cargo/core/resolver/mod.rs
Outdated
There was a problem hiding this comment.
Don't quite follow this sentence.
There was a problem hiding this comment.
Oops, "to do" was meant to be "due to"
src/cargo/core/resolver/mod.rs
Outdated
|
☔ The latest upstream changes (presumably #5187) made this pull request unmergeable. Please resolve the merge conflicts. |
|
To be clear I am +1 when you feel this is ready and it is mergeable. :-) Then I think working together, we are in a good place to solve #4810 (comment); the last reproducible and in the wild exponentially slow resolution (that I have found). |
b574800 to
20239d2
Compare
|
Ok I've rebased and updated with the recent merge conflict, @Eh2406 mind giving it a once over to make sure it still makes sense? |
20239d2 to
92fb7d0
Compare
Eh2406
left a comment
There was a problem hiding this comment.
Lots of good in this PR! Just some small nits, and ci is red.
src/cargo/core/resolver/mod.rs
Outdated
There was a problem hiding this comment.
Nit: I think it returns a map of all conflicting already activated PackageId not a map of the filtered (not yet activated) candidates.
src/cargo/core/resolver/mod.rs
Outdated
There was a problem hiding this comment.
I think this has the structure backwards, where each package id that has already been activated that causes something to be filtered out to the reason it caused a candidate to be skipped.
src/cargo/core/resolver/mod.rs
Outdated
There was a problem hiding this comment.
This is a very well explained description of what is happening. Perhaps it can be used for my nits.
src/cargo/core/resolver/mod.rs
Outdated
This is currently my best-effort attempt to document various portions of the resolver with the logic that's been added recently. It at least helped me understand a bit what was going on so I hope it can help others as well!
92fb7d0 to
5695119
Compare
|
@bors: r=Eh2406 Ok cool, thanks for double checking me! |
|
📌 Commit 5695119 has been approved by |
|
⌛ Testing commit 5695119 with merge 6ececacf83586369c86be162153c9e45d75f6920... |
|
@bors: retry |
|
💔 Test failed - status-travis |
|
@bors: retry |
1 similar comment
|
@bors: retry |
Add some documentation to the resolver I spent a few hours yesterday re-teaching myself the resolver and wanted to add some comments along the way!
|
☀️ Test successful - status-appveyor, status-travis |
I spent a few hours yesterday re-teaching myself the resolver and wanted to add some comments along the way!