- 
                Notifications
    You must be signed in to change notification settings 
- Fork 13.9k
Closed
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
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.
use std::mem;
use std::time::Instant;
fn assert_size<T>(want: usize) {
    assert_eq!(mem::size_of::<T>(), want);
}
fn main() {
    // This is 16 on Linux, but 8 on MacOS (and Windows?).
    assert_size::<Instant>(16);
    // This is 24 on Linux, but 16 on MacOS (and Windows?).
    assert_size::<Option<Instant>>(24);
}Metadata
Metadata
Assignees
Labels
C-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.