You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: posts/2022-04-07-Rust-1.60.0.md
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -124,6 +124,32 @@ In this example, enabling the serde feature will enable the serde dependency. It
124
124
125
125
Incremental compilation is re-enabled for the 1.60 release. The Rust team continues to work on fixing bugs in incremental, but no problems causing widespread breakage are known at this time, so we have chosen to reenable incremental compilation. Additionally, the compiler team is continuing to work on long-term strategy to avoid future problems of this kind. That process is in relatively early days, so we don't have anything to share yet on that front.
126
126
127
+
### `Instant` monotonicity guarantees
128
+
129
+
On all platforms `Instant` will try to use an OS API that guarantees monotonic
130
+
behavior if available (which is the case on all tier 1 platforms). In practice
131
+
such guarantees are -- under rare circumstances -- broken by hardware,
132
+
virtualization or operating system bugs. To work around these bugs and platforms
133
+
not offering monotonic clocks `Instant::duration_since`, `Instant::elapsed` and
134
+
`Instant::sub` saturate to zero. In older Rust versions this lead to a panic
135
+
instead. `Instant::checked_duration_since` can be used to detect and handle
136
+
situations where monotonicity is violated, or `Instant`s are subtracted in the
137
+
wrong order.
138
+
139
+
This workaround obscures programming errors where earlier and later instants are
140
+
accidentally swapped. For this reason future Rust versions may reintroduce
141
+
panics in at least those cases.
142
+
143
+
Prior to 1.60, the monotonicity guarantees were provided through mutexes or
144
+
atomics in std, which can introduce large performance overheads to
145
+
`Instant::now()`. Additionally, the panicking behavior meant that Rust software
146
+
could panic in a subset of environments, which was largely undesirable, as the
147
+
authors of that software may not be in a place to upgrade the operating system,
148
+
hardware, or virtualization system they are running on. Further, introducing
149
+
unexpected panics into these environments make Rust software less reliable and
150
+
portable, which is of higher concern than exposing typically uninteresting
151
+
platform bugs to end users.
152
+
127
153
### Stabilized APIs
128
154
129
155
The following methods and trait implementations are now stabilized:
0 commit comments