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

Maintain backwards compatibility for bitflags types #1096

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

kjughx
Copy link
Contributor

@kjughx kjughx commented Nov 12, 2024

Between versions 0.17.x and git2-0.18.0, bitflags was updated from 1.x to 2.1 which reduced the amount of derived traits on bitflags types. This in turn broke backwards compatibility since now bitflags types no longer implement PartialOrd, Ord and Hash.

The changelog of bitflags 2.0.0 mentions that:

If you need to maintain backwards compatibility, you can derive the following yourself:
#[derive(PartialEq, Eq, PartialOrd, Ord, Hash, Debug, Clone, Copy)]

This fixes #1095.

@ehuss
Copy link
Contributor

ehuss commented Nov 12, 2024

Thanks! Can you say what your use case is for being able to order the flags?

@kjughx
Copy link
Contributor Author

kjughx commented Nov 12, 2024

Perhaps minor thing, I wrote a program which displays a git status over a workspace which includes many repositories, and wanted the changes to be grouped by their status flag, i.e. first all new files, then all modified or whatever, but group them in sections based on status. A niche use case sure but not a reason to break backwards compatibility imho.

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks!

@ehuss ehuss added this pull request to the merge queue Nov 12, 2024
Merged via the queue into rust-lang:master with commit a2e05da Nov 12, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing Ord implementation for bitflags types
2 participants