Skip to content

std: don't panic on long-elapsed deadlines for sleep_until - #161295

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
joboet:sleep_until-long-elapsed
Aug 21, 2026
Merged

std: don't panic on long-elapsed deadlines for sleep_until#161295
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
joboet:sleep_until-long-elapsed

Conversation

@joboet

@joboet joboet commented Aug 18, 2026

Copy link
Copy Markdown
Member

clock_nanosleep doesn't like deadlines before the clock's epoch, so sleep_until can currently panic (playground). Unfortunately the POSIX specification is quite vague about which timespec values are allowed, see the code comment...

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 18, 2026
@rustbot

rustbot commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: @ChrisDenton, libs
  • @ChrisDenton, libs expanded to 13 candidates
  • Random selection from 6 candidates

@tgross35

Copy link
Copy Markdown
Member

Could you add not about times in the past to the docs for sleep_until?

I expect this is the behavior we want, cc @rust-lang/libs just in case.

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rust-bors

rust-bors Bot commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 2d28ce9 has been approved by tgross35

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 10. This pull request will be tested once the tree is reopened.

Reason for tree closure: Main branch is broken

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 20, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 20, 2026
…=tgross35

std: don't panic on long-elapsed deadlines for `sleep_until`

`clock_nanosleep` doesn't like deadlines before the clock's epoch, so `sleep_until` can currently panic ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=90acf91e5d4cd3bbb64187a26707d0d8)). Unfortunately the POSIX specification is quite vague about which `timespec` values are allowed, see the code comment...
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 20, 2026
…=tgross35

std: don't panic on long-elapsed deadlines for `sleep_until`

`clock_nanosleep` doesn't like deadlines before the clock's epoch, so `sleep_until` can currently panic ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=90acf91e5d4cd3bbb64187a26707d0d8)). Unfortunately the POSIX specification is quite vague about which `timespec` values are allowed, see the code comment...
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 20, 2026
…=tgross35

std: don't panic on long-elapsed deadlines for `sleep_until`

`clock_nanosleep` doesn't like deadlines before the clock's epoch, so `sleep_until` can currently panic ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=90acf91e5d4cd3bbb64187a26707d0d8)). Unfortunately the POSIX specification is quite vague about which `timespec` values are allowed, see the code comment...
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 20, 2026
…=tgross35

std: don't panic on long-elapsed deadlines for `sleep_until`

`clock_nanosleep` doesn't like deadlines before the clock's epoch, so `sleep_until` can currently panic ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=90acf91e5d4cd3bbb64187a26707d0d8)). Unfortunately the POSIX specification is quite vague about which `timespec` values are allowed, see the code comment...
rust-bors Bot pushed a commit that referenced this pull request Aug 20, 2026
…uwer

Rollup of 20 pull requests

Successful merges:

 - #152617 (std: implement `sleep_until` for Fuchsia)
 - #158934 (diagnostics: fix `let x: vec![]` suggestion pointing into stdlib)
 - #161277 (bootstrap: Move all non-module items out of the crate root)
 - #161295 (std: don't panic on long-elapsed deadlines for `sleep_until`)
 - #161368 (Double-word align `_Unwind_Exception`)
 - #161370 (Uplift rustfmt macro formatting fix)
 - #161378 (`FlowSensitiveAnalysis` cleanups)
 - #158032 (Offload expose device selection)
 - #158855 (Add `desktop` method to `CommandExt`)
 - #161199 (Add regression test for non lifetime binders)
 - #161302 (Add regression test for inconsistent import resolution from issue 147208)
 - #161329 (Add regression tests for a few fixed issues with E-needs-test)
 - #161330 (Add regression test for nested RPIT not an iterator ICE)
 - #161351 (Cleanup: Move impl of `#[rustc_dump_object_lifetime_defaults]`)
 - #161355 (Add file path to some archive build errors)
 - #161373 (Allow running EC2 jobs locally)
 - #161393 (Configure LLM policy URL for triagebot)
 - #161409 (Add back `tests/rustdoc-gui/notable-trait.goml` test)
 - #161410 (Fix rustdoc remapping `documentation` scope documentation)
 - #161415 (Update expect messages in path docs to better follow guidelines)
rust-bors Bot pushed a commit that referenced this pull request Aug 21, 2026
Rollup of 25 pull requests

Successful merges:

 - #152617 (std: implement `sleep_until` for Fuchsia)
 - #158934 (diagnostics: fix `let x: vec![]` suggestion pointing into stdlib)
 - #160995 (Tiny readability cleanups for initialization dataflow analyses)
 - #161277 (bootstrap: Move all non-module items out of the crate root)
 - #161295 (std: don't panic on long-elapsed deadlines for `sleep_until`)
 - #161368 (Double-word align `_Unwind_Exception`)
 - #161370 (Uplift rustfmt macro formatting fix)
 - #161378 (`FlowSensitiveAnalysis` cleanups)
 - #161420 (Bump wasm-component-ld to 0.5.30)
 - #161429 (Tighten allocator `Send`/`Sync` requirements for `Arc` in preparation for refactor)
 - #158032 (Offload expose device selection)
 - #158855 (Add `desktop` method to `CommandExt`)
 - #160299 (Stabilize `bool::toggle`)
 - #160842 (Apply `&[T]` visualizer to `*const [T]`, `*mut [T]` and `Box<[T]>`)
 - #160981 (Partially support building and locating wasm proc-macros)
 - #161199 (Add regression test for non lifetime binders)
 - #161212 (rust-installer/install-template.sh: catch cp(1) error when installing…)
 - #161302 (Add regression test for inconsistent import resolution from issue 147208)
 - #161329 (Add regression tests for a few fixed issues with E-needs-test)
 - #161330 (Add regression test for nested RPIT not an iterator ICE)
 - #161331 (Bitset simplifications)
 - #161340 (rustdoc: enable scrolling only on table/code)
 - #161351 (Cleanup: Move impl of `#[rustc_dump_object_lifetime_defaults]`)
 - #161355 (Add file path to some archive build errors)
 - #161373 (Allow running EC2 jobs locally)
rust-bors Bot pushed a commit that referenced this pull request Aug 21, 2026
Rollup of 25 pull requests

Successful merges:

 - #152617 (std: implement `sleep_until` for Fuchsia)
 - #158934 (diagnostics: fix `let x: vec![]` suggestion pointing into stdlib)
 - #160995 (Tiny readability cleanups for initialization dataflow analyses)
 - #161277 (bootstrap: Move all non-module items out of the crate root)
 - #161295 (std: don't panic on long-elapsed deadlines for `sleep_until`)
 - #161368 (Double-word align `_Unwind_Exception`)
 - #161370 (Uplift rustfmt macro formatting fix)
 - #161378 (`FlowSensitiveAnalysis` cleanups)
 - #161420 (Bump wasm-component-ld to 0.5.30)
 - #161429 (Tighten allocator `Send`/`Sync` requirements for `Arc` in preparation for refactor)
 - #158032 (Offload expose device selection)
 - #158855 (Add `desktop` method to `CommandExt`)
 - #160299 (Stabilize `bool::toggle`)
 - #160842 (Apply `&[T]` visualizer to `*const [T]`, `*mut [T]` and `Box<[T]>`)
 - #160981 (Partially support building and locating wasm proc-macros)
 - #161199 (Add regression test for non lifetime binders)
 - #161212 (rust-installer/install-template.sh: catch cp(1) error when installing…)
 - #161302 (Add regression test for inconsistent import resolution from issue 147208)
 - #161329 (Add regression tests for a few fixed issues with E-needs-test)
 - #161330 (Add regression test for nested RPIT not an iterator ICE)
 - #161331 (Bitset simplifications)
 - #161340 (rustdoc: enable scrolling only on table/code)
 - #161351 (Cleanup: Move impl of `#[rustc_dump_object_lifetime_defaults]`)
 - #161355 (Add file path to some archive build errors)
 - #161373 (Allow running EC2 jobs locally)
@rust-bors
rust-bors Bot merged commit b7dba0e into rust-lang:main Aug 21, 2026
13 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Aug 21, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 21, 2026
Rollup merge of #161295 - joboet:sleep_until-long-elapsed, r=tgross35

std: don't panic on long-elapsed deadlines for `sleep_until`

`clock_nanosleep` doesn't like deadlines before the clock's epoch, so `sleep_until` can currently panic ([playground](https://play.rust-lang.org/?version=nightly&mode=debug&edition=2024&gist=90acf91e5d4cd3bbb64187a26707d0d8)). Unfortunately the POSIX specification is quite vague about which `timespec` values are allowed, see the code comment...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants