multiple platforms incorrectly impl thread::sleep with Duration::as_micros · Issue #129212 · rust-lang/rust (original) (raw)

Multiple targets currently use Duration::as_micros to implement conversion from a Duration to a value in microseconds. However, thread::sleep currently reads as so:

Platforms which do not support nanosecond precision for sleeping will have dur rounded up to the nearest granularity of time they can sleep for.

Up. Note this Playground which means Duration::as_micros is not a valid implementation of this spec.

Note that this is not the only problem that espidf poses with respect to its std implementation: #129136

Meta

rustc --version --verbose:

rustc 1.82.0-nightly (2c93fabd9 2024-08-15)
binary: rustc
commit-hash: 2c93fabd98d2c183bcb3afed1f7d51b2517ac5ed
commit-date: 2024-08-15
host: x86_64-unknown-linux-gnu
release: 1.82.0-nightly
LLVM version: 19.1.0