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

Update use of libc::timespec to prepare for future libc version #528

Merged
merged 1 commit into from Nov 26, 2022

Conversation

wesleywiser
Copy link

In a future release of the libc crate, libc::timespec will contains private padding fields on 32-bit *-linux-musl targets and so the struct will no longer be able to be created using the literal initializer syntax.

The only uses in this crate of libc::timespec in this way were zero initializing the struct. Thus, these can be replaced by a call to std::mem::zeroed() which is compatible with both current versions of the libc crate as well as the future version which will contain those private padding fields.

I tested this locally both with a modified libc/i686-unknown-linux-musl target and with the current libc/i686-unknown-linux-musl target. The code builds and all tests pass. The GH workflow required disabling a deny(warnings) for new warnings that are emitted since the last time the branch was built but it succeeded other than the test-old tasks which failed because of dependency resolution errors with the cfg-if crate.

Related to rust-lang/libc#2088

In a future release of the `libc` crate, `libc::timespec` will contains
private padding fields on 32-bit `*-linux-musl` targets and so the
struct will no longer be able to be created using the literal
initializer syntax.

The only uses in this crate of `libc::timespec` in this way were zero
initializing the struct. Thus, these can be replaced by a call to
`std::mem::zeroed()` which is compatible with both current versions of
the `libc` crate as well as the future version which will contain those
private padding fields.
@jhpratt jhpratt merged commit 6a06308 into time-rs:v0.1 Nov 26, 2022
@jhpratt
Copy link
Member

jhpratt commented Nov 26, 2022

This will be released as soon as I can fix CI. It's changed a fair amount since the last 0.1 release.

@jhpratt
Copy link
Member

jhpratt commented Nov 26, 2022

Well, CI passes when using the latest stable, but fails with a linker error on MacOS on 1.21.0. I am able to successfully cross-compile it from Linux to MacOS on 1.21.0, so I'm releasing as-is. We'll find out soon enough if there are any issues 😄

@wesleywiser
Copy link
Author

Just FYI that seems to be a common issue with older Rust versions on newer macOS versions: Amanieu/parking_lot#363 (comment)

Thanks so much for your help with this!

@jhpratt
Copy link
Member

jhpratt commented Nov 26, 2022

Well, so be it. I figured if I could cross-compile it, then there was no true issue. Thanks for doing the legwork of the various patches.

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.

None yet

2 participants