Rollup of 8 pull requests - #162501
Closed
JonathanBrouwer wants to merge 38 commits into
Closed
Conversation
Drop the unused name parameter from `Thread::new_current`, abort if the OS id is set twice, and stop promising uniqueness of os_id in the docs.
diff --git a/library/std/src/thread/thread.rs b/library/std/src/thread/thread.rs index ff6affa..d70c244 100644 --- a/library/std/src/thread/thread.rs +++ b/library/std/src/thread/thread.rs @@ -125,7 +125,8 @@ pub(crate) fn new_current(id: ThreadId) -> Thread { thread } - /// Records the OS id of the calling thread in this handle. + /// Records the calling thread's OS id, as reported by + /// `imp::current_os_id`, in this handle. /// /// May only be called from the thread to which this handle belongs. A /// spawned thread does this itself once it starts running, since its handle @@ -240,12 +241,17 @@ pub fn id(&self) -> ThreadId { /// /// This is the id that shows up in tools like `ps` and `top`, debuggers and /// crash logs, unlike [`ThreadId`], which has no guaranteed relationship to - /// it. `None` means the platform has no such id, the thread has not started - /// running yet, or the id could not be read. + /// it. On a platform with no OS-visible thread id, such as SGX, the value + /// may be some other per-thread value (there, the thread's address), which + /// such tools will not recognize. `None` means no id could be recorded: the + /// thread has not started running yet, or the platform has no way to read + /// one. /// /// The operating system may reuse the id of a thread that has exited, and a - /// `Thread` handle can outlive the thread it refers to. Use the id only - /// where a reused id is harmless, such as logging. + /// `Thread` handle can outlive the thread it refers to. After a `fork`, the + /// id recorded in the child process still refers to the parent's thread; it + /// is not re-read. Use the id only where a reused or stale id is harmless, + /// such as logging. /// /// # Examples ///
`Assumptions::new` now elaborates the clauses it is given, so callers which build assumptions straight from where clauses no longer each have to remember to do it themselves. A `Ty: 'a` clause also tells us that every region component of `Ty` outlives `'a`, and that the components themselves do, which placeholder and alias outlives need. It takes clauses rather than only the outlives ones because trait clauses imply outlives through their supertraits: `T: Bound<'a>` with `trait Bound<'c>: 'static` is evidence for `T: 'static`. Narrowing the input to outlives clauses would drop those before elaboration could reach them. The test harness keeps using `new_unelaborated` so that a `forall`'s assumptions are exactly the ones written down in the test, with no extra ones hidden behind the scenes.
`known_type_outlives` only holds the explicit `Ty: 'a` where clauses. The implied bounds, e.g. `T: 'a` from a `&'a T` argument, are tracked separately in `region_bound_pairs`, so both have to be passed in. Without them we fail to prove `T: 'a` for a `&'a T` argument whenever the only explicit bound on `T` mentions a different region.
`FreeRegionMap::relation` stores `'sub <= 'sup` edges while `Assumptions::region_outlives` expects `'longer: 'shorter` ones. The mismatch is not yet observable as nothing reads the region relation at the root, but `Assumptions::new` merges edges derived from type outlives clauses into the same relation, which would otherwise leave it with mixed edge directions.
…es, r=nikomatsakis Support move expressions in coroutine closures This adds `move(expr)` support for coroutine closures. - [x] Support for move expressions in coroutine closures - [x] Support for move expressions in async blocks RFC: rust-lang/rfcs#3968 Tracking issue: rust-lang#155050 Project goal: - rust-lang/goals#107 - https://rust-lang.github.io/rust-project-goals/2026/ergonomic-rc.html I used AI to write the tests and reviewed them myself. r? @nikomatsakis
Implement `Thread::os_id` Implements `Thread::os_id` as an unstable feature, per the accepted ACP rust-lang/libs-team#635. Tracking issue: rust-lang#160215 `os_id` returns the OS-level thread id, so Rust programs can tie their own logs to system-level logs (the ACP's stated motivation). - Using the existing `current_os_id` is much simpler than pulling the id off `imp::Thread` in `spawn_unchecked`. That needs a per-platform arm, and the child still has to fill it in on platforms without a by handle query, so it'd be extra on top of this rather than instead of it. - `Thread` is handed to user code by spawn hooks before the native thread exists, so the id can only be filled in later. There's no spare `u64` value to mean "not set yet", so a OnceLock is chosen as a simple primitive to use for this purpose. r? libs
…e-redundant-shared-reference, r=mati865 Prefer removing a redundant shared reference over reborrow Fixes rust-lang#133685
…=petrochenkov Ignore `self-in-const-generics` test for parallel frontend This is the guidance for failing tests in the parallel frontend per [#t-infra/announcements > rustc parallel frontend CI job @ 💬](https://rust-lang.zulipchat.com/#narrow/channel/533458-t-infra.2Fannouncements/topic/rustc.20parallel.20frontend.20CI.20job/near/612990835) To work around rust-lang#162316
…utlives_assumptions, r=BoxyUwU trait solver: Include implied outlives assumptions Part of rust-lang/project-assumptions-on-binders#19 Split out of rust-lang#161988 after @BoxyUwU pointed out that these are about which assumptions we keep, not really about reflexive region constraints. I went back through where each piece comes from and found two gaps. Inside a binder we kept `Ty: 'a`, but the region relation only knew about explicit region clauses. That means something like `&'b T: 'a` did not also give us `'b: 'a`. At the root it was a slightly different version of the same problem: `known_type_outlives` has the explicit where clauses, while implied bounds from things like `&'b self` live in `region_bound_pairs`, so constraint destructuring never saw them. `Assumptions::new` now pulls the free region components out of type outlives clauses and adds those edges to the region relation. I think doing it there is the cleanest spot. All callers get the same view of an assumption, and the original type clauses stay around for placeholder and alias cases. Regions bound inside the type are ignored because they do not name anything we can use outside that binder. The root path now adds its implied type bounds to the same assumption set before destructuring. The regression uses an implied `I: 'b` from a receiver and a separate `'b: 'a` relation, so it covers this without leaning on the reflexive fix from rust-lang#161988. There are also binder checks for a reference and a higher-ranked function type. Those caught an easy testing trap here: a green direct constraint could have depended on the other PR, so the checks look at the lifted candidates instead. Personally, I think splitting this was the right call. It is really a change to how assumption data is built, and that is easier to reason about on its own than under the reflexive constraint fix. cc @BoxyUwU, this is the pair of changes you asked me to pull out.
Small `x perf` improvements Tiny improvements I found while using this command locally. r? JonathanBrouwer
…ys, r=JonathanBrouwer Clean up on upvar_tys Found some duplicated code when digging rust-lang#162440 r? @lcnr
…aumeGomez Move the `expect-item-after-attribute.rs` test to the correct directory To address the comment here: rust-lang#162386 (comment) r? @GuillaumeGomez
Member
Author
Contributor
This comment has been minimized.
This comment has been minimized.
rust-bors Bot
pushed a commit
that referenced
this pull request
Sep 8, 2026
Rollup of 8 pull requests try-job: dist-various-1 try-job: test-various try-job: test-x86_64-gnu-aux try-job: test-x86_64-gnu-llvm-21-3 try-job: test-x86_64-msvc-1 try-job: test-aarch64-apple-1 try-job: test-aarch64-apple-2 try-job: test-x86_64-mingw-1 try-job: test-i686-msvc-1 try-job: test-i686-msvc-2 try-job: test-armhf-gnu
Contributor
|
This pull request was unapproved due to being closed. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Successful merges:
Thread::os_id#160219 (ImplementThread::os_id)self-in-const-genericstest for parallel frontend #162494 (Ignoreself-in-const-genericstest for parallel frontend)x perfimprovements #162473 (Smallx perfimprovements)expect-item-after-attribute.rstest to the correct directory #162500 (Move theexpect-item-after-attribute.rstest to the correct directory)r? @ghost
Create a similar rollup