-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
time::Instant
is a different size of different platforms
#43332
Comments
Why do you want to make assertions about the size of a struct with an |
I’m using it as a deadline. And I want to make sure the struct doesn’t grow in the future, it’s big enough already.
Met vriendelijke groet,
Thomas de Zeeuw
https://thomasdezeeuw.nl <https://thomasdezeeuw.nl/>
thomasdezeeuw@gmail.com <mailto:thomasdezeeuw@gmail.com>
… On 19 Jul 2017, at 17:40, Steven Fackler ***@***.***> wrote:
Why do you want to make assertions about the size of a struct with an Instant in it?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#43332 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ADA0GOswRaZTctqyIqV6pG0UspWNHvikks5sPiNXgaJpZM4Ocr8R>.
|
Perhaps you could use |
That is what I’m currently using. It just seemed odd so I filed this bug for it. But if no change is possible or desired it might be worth documenting it?
Met vriendelijke groet,
Thomas de Zeeuw
https://thomasdezeeuw.nl <https://thomasdezeeuw.nl/>
thomasdezeeuw@gmail.com <mailto:thomasdezeeuw@gmail.com>
… On 19 Jul 2017, at 18:05, Mark Simulacrum ***@***.***> wrote:
Perhaps you could use #[cfg(unix)]? I don't think it's likely that we'll change anything to increase or decrease the size of Instant based on platform... On OS X today, an Instant is defined by u64 whereas on other unix platforms it's a libc::timespec... I would presume that this is correct and won't change.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub <#43332 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ADA0GDGVlzPDcnC88ct0mePxUu5_ReTwks5sPik3gaJpZM4Ocr8R>.
|
Hm, well, I'll nominate for libs team, but I personally don't think documenting differences in size really makes sense today. |
@Mark-Simulacrum stuff like this could be a good candidate for the "portability lint" discussed here and here. |
The libs team decided that we're not going to make any guarantees about sizes of structs, and we've opened #43601 to track documenting that the sizes may be different. |
Sounds good to me. |
time::Instant
on Linux is 16 bytes, while it is 8 bytes on MacOs. This makes it hard to assert the size of any structs using it.Playground link
The text was updated successfully, but these errors were encountered: