about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorYuki Okushi <jtitor@2k36.org>2022-09-29 11:42:05 +0900
committerGitHub <noreply@github.com>2022-09-29 11:42:05 +0900
commit8e4869e8629854dbebc39e6b14a7c8ceab033c58 (patch)
tree93f1f3500ea86b6cf4068475ba6180656be61a83 /src
parent19e84b91e564eea334691ea064a742b32598d6f9 (diff)
parenta91327782906885ccd8b8bf25e1e7f9ea46f8428 (diff)
downloadrust-8e4869e8629854dbebc39e6b14a7c8ceab033c58.tar.gz
rust-8e4869e8629854dbebc39e6b14a7c8ceab033c58.zip
Rollup merge of #102368 - beetrees:nano-niche, 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```
Diffstat (limited to 'src')
-rw-r--r--src/etc/natvis/libcore.natvis4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/etc/natvis/libcore.natvis b/src/etc/natvis/libcore.natvis
index a4e8a57e4b1..624d8cc5cc5 100644
--- a/src/etc/natvis/libcore.natvis
+++ b/src/etc/natvis/libcore.natvis
@@ -154,10 +154,10 @@
   </Type>
 
   <Type Name="core::time::Duration">
-    <DisplayString>{secs,d}s {nanos,d}ns</DisplayString>
+    <DisplayString>{secs,d}s {nanos.__0,d}ns</DisplayString>
     <Expand>
       <Item Name="seconds">secs,d</Item>
-      <Item Name="nanoseconds">nanos,d</Item>
+      <Item Name="nanoseconds">nanos.__0,d</Item>
     </Expand>
   </Type>
 </AutoVisualizer>