Skip to content

Commit ffc8e26

Browse files
Apply suggestions from code review
Co-authored-by: Josh Triplett <josh@joshtriplett.org>
1 parent 5e7e07a commit ffc8e26

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

posts/2022-04-07-Rust-1.60.0.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,26 +129,26 @@ Incremental compilation is re-enabled for the 1.60 release. The Rust team contin
129129
On all platforms `Instant` will try to use an OS API that guarantees monotonic
130130
behavior if available (which is the case on all tier 1 platforms). In practice
131131
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
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` now saturate to zero. In older Rust versions this led to a panic
135135
instead. `Instant::checked_duration_since` can be used to detect and handle
136136
situations where monotonicity is violated, or `Instant`s are subtracted in the
137137
wrong order.
138138

139139
This workaround obscures programming errors where earlier and later instants are
140140
accidentally swapped. For this reason future Rust versions may reintroduce
141-
panics in at least those cases.
141+
panics in at least those cases, if possible and efficient.
142142

143143
Prior to 1.60, the monotonicity guarantees were provided through mutexes or
144144
atomics in std, which can introduce large performance overheads to
145145
`Instant::now()`. Additionally, the panicking behavior meant that Rust software
146146
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,
147+
authors of that software may not be able to fix or upgrade the operating system,
148148
hardware, or virtualization system they are running on. Further, introducing
149-
unexpected panics into these environments make Rust software less reliable and
149+
unexpected panics into these environments made Rust software less reliable and
150150
portable, which is of higher concern than exposing typically uninteresting
151-
platform bugs to end users.
151+
platform bugs in monotonic clock handling to end users.
152152

153153
### Stabilized APIs
154154

0 commit comments

Comments
 (0)