Add a niche to Duration, unix SystemTime, and non-apple Instant#102368
Add a niche to Duration, unix SystemTime, and non-apple Instant#102368bors merged 1 commit intorust-lang:masterfrom
Duration, unix SystemTime, and non-apple Instant#102368Conversation
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @joshtriplett (or someone else) soon. Please see the contribution instructions for more information. |
|
Hey! It looks like you've submitted a new PR for the library teams! If this PR contains changes to any Examples of
|
|
r=me with |
68459a8 to
b9b969a
Compare
|
@joshtriplett |
|
@bors r+ rollup |
Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant` As the nanoseconds fields is always between `0` and `(NANOS_PER_SEC - 1)` inclusive, use the `rustc_layout_scalar_valid_range` attributes to create a niche in the nanosecond field of `Duration` and `Timespec` (which is used to implement unix `SystemTime` and non-apple unix `Instant`; windows `Instant` is implemented with `Duration` and therefore will also benefit). This change has the benefit of making `Option<T>` the same size as `T` for the previously mentioned types. Also shrinks the nanoseconds field of `Timespec` to a `u32` as nanoseconds do not need the extra range of an `i64`, shrinking `Timespec` by 4 bytes on 32-bit platforms. r? `@joshtriplett`
b9b969a to
a913277
Compare
|
@bors r+ rollup |
|
The debugger visualization / natvis for Windows wasn't adjusted to handle the new struct. |
Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant` As the nanoseconds fields is always between `0` and `(NANOS_PER_SEC - 1)` inclusive, use the `rustc_layout_scalar_valid_range` attributes to create a niche in the nanosecond field of `Duration` and `Timespec` (which is used to implement unix `SystemTime` and non-apple unix `Instant`; windows `Instant` is implemented with `Duration` and therefore will also benefit). This change has the benefit of making `Option<T>` the same size as `T` for the previously mentioned types. Also shrinks the nanoseconds field of `Timespec` to a `u32` as nanoseconds do not need the extra range of an `i64`, shrinking `Timespec` by 4 bytes on 32-bit platforms. r? `@joshtriplett`
Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant` As the nanoseconds fields is always between `0` and `(NANOS_PER_SEC - 1)` inclusive, use the `rustc_layout_scalar_valid_range` attributes to create a niche in the nanosecond field of `Duration` and `Timespec` (which is used to implement unix `SystemTime` and non-apple unix `Instant`; windows `Instant` is implemented with `Duration` and therefore will also benefit). This change has the benefit of making `Option<T>` the same size as `T` for the previously mentioned types. Also shrinks the nanoseconds field of `Timespec` to a `u32` as nanoseconds do not need the extra range of an `i64`, shrinking `Timespec` by 4 bytes on 32-bit platforms. r? ``@joshtriplett``
Rollup of 8 pull requests Successful merges: - rust-lang#98368 (Make `std::os::fd` public.) - rust-lang#102085 (Code refactoring smart_resolve_report_errors) - rust-lang#102351 (Improve E0585 help) - rust-lang#102368 (Add a niche to `Duration`, unix `SystemTime`, and non-apple `Instant`) - rust-lang#102393 (Add regression test for issue 94923) - rust-lang#102399 (Account for use of index-based lifetime names in print of binder) - rust-lang#102416 (remove FIXME, improve documentation) - rust-lang#102433 (env::temp_dir: fix a typo) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
As the nanoseconds fields is always between
0and(NANOS_PER_SEC - 1)inclusive, use therustc_layout_scalar_valid_rangeattributes to create a niche in the nanosecond field ofDurationandTimespec(which is used to implement unixSystemTimeand non-apple unixInstant; windowsInstantis implemented withDurationand therefore will also benefit). This change has the benefit of makingOption<T>the same size asTfor the previously mentioned types. Also shrinks the nanoseconds field ofTimespecto au32as nanoseconds do not need the extra range of ani64, shrinkingTimespecby 4 bytes on 32-bit platforms.r? @joshtriplett