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

Derive Debug and eq. comparison traits for InvalidRustTarget enum #3055

Merged

Conversation

AlexTMjugador
Copy link
Contributor

@AlexTMjugador AlexTMjugador commented Dec 13, 2024

These traits are useful to get expressions like RustTarget::stable(82, 0).unwrap() to build, as unwrap() requires such a Result to implement Debug. The equality comparison traits may also be useful in cases where pattern matching the enum variants through e.g. matches! or match expressions is deemed less stylish. The Hash trait is also derived in case anyone wants to put these variants into a hash table based data structure.

These traits are useful to get expressions like `RustTarget::stable(82,
0).unwrap()` to build, as `unwrap()` requires such a `Result` to
implement `Debug`. The equality comparison traits may also be useful in
cases where pattern matching the enum variants through e.g. `matches!`
or match expressions is deemed less stylish.
AlexTMjugador added a commit to ComunidadAylas/vorbis-rs that referenced this pull request Dec 13, 2024
This will make it slightly easier to target Rust's 2024 edition, where
the `unsafe` keyword will be required for `extern` blocks like these.

I'd like to also not use the now deprecated Rust version constants
offered by `bindgen`, but the ergonomics of the alternative syntax can
be improved and we can try to make it better upstream - see
rust-lang/rust-bindgen#3055.
@emilio emilio added this pull request to the merge queue Dec 13, 2024
Merged via the queue into rust-lang:main with commit 3e0094e Dec 13, 2024
34 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.

2 participants