pubgrub-rs / pubgrub

PubGrub version solving algorithm implemented in Rust
https://pubgrub-rs.github.io/pubgrub/pubgrub/
Mozilla Public License 2.0
337 stars 29 forks source link

Generic reason for custom incompatibility #208

Closed konstin closed 1 month ago

konstin commented 2 months ago

Restructure the incompatibility into pubgrub internal metadata and a custom external type.

The internal types are:

I'm currently working on adapting the formatting to adapt to the uv of this. This should reduce our diff significantly.

This refactoring is relevant to collapsing custom incompatibilities, but i haven't looked into this properly yet.

Eh2406 commented 2 months ago

Sorry for the delay. I just had a chance to look at the diff, and I absolutely love it. Thank you so much! I need to poke at this in an editor before I write up the few nits I have.

konstin commented 2 months ago

Should we create a trait for M: Eq + Clone + Debug + Display?

Eh2406 commented 2 months ago

Yes. I think we should have a trait. Although it could be in a follow-up PR. It should, one day, have a method can_merge(&Self, &Self) -> Option<Self> instead of the Eq bound. None would mark that the two incompatibilities should not be merged. And Some(M) would provide the new metadata for the merged incompatibility. That would allow a error like "unavailable because of HTTP 404, with request ID 123456789" to be merged with "unavailable because of HTTP 404, with request ID 987654321" even though they are not structurally equal.