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

Breaking change in nix 0.26.3 due to bitflags upgrade #2112

Closed
ogoffart opened this issue Aug 28, 2023 · 2 comments
Closed

Breaking change in nix 0.26.3 due to bitflags upgrade #2112

ogoffart opened this issue Aug 28, 2023 · 2 comments

Comments

@ogoffart
Copy link

In nix 0.26.3, the bitflags crate was updated which is technically a breaking change.
For example, the function nix::fcntl::OFlag::from_bits_unchecked no longer exist.

(Note: while we were using that function in our project, we're going to port to 0.27 anyway so we're not going to be impacted by this change, but i just wanted to report the issue just in case you think this is worth fixing. I can suggest either reverting the change, or add the missing functions in libc_bitflags macro. )

@ogoffart
Copy link
Author

we're not going to be impacted by this change

Actually, i spoke too soon, one of my dependencies from crates.io (calloop) is impacted

error[E0599]: no function or associated item named `from_bits_unchecked` found for struct `OFlag` in the current scope
  --> ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/calloop-0.11.0/src/io.rs:55:41
   |
55 |         let old_flags = unsafe { OFlag::from_bits_unchecked(old_flags) };
   |                                         ^^^^^^^^^^^^^^^^^^^ function or associated item not found in `OFlag`

In light of that, i believe something should be done about it. (and 0.26.3 should probably be yanked)

asomers added a commit to asomers/nix that referenced this issue Aug 28, 2023
This reverts commit 0c3afc2.

This rolls back the version of bitflags used to 1.1.  Upgrading bitflags
to 2.0 inadvertently caused breaking changes in the r0.26 branch, by
virtue of the methods that the bitflags! macro adds.

Also, mask the bad_bit_mask lint, triggered by bitflags's generated
code.  That lint was the motivation for upgrading bitflags in the first
place.  The bitflags maintainers have decided not to fix those warnings
in the 1.x release series.
bitflags/bitflags#373

Fixes nix-rust#2112
@asomers
Copy link
Member

asomers commented Aug 29, 2023

Fixed by #2117 .

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

No branches or pull requests

2 participants