Skip to content

Rollup of 8 pull requests - #162501

Closed
JonathanBrouwer wants to merge 38 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-1XmDOYn
Closed

Rollup of 8 pull requests#162501
JonathanBrouwer wants to merge 38 commits into
rust-lang:mainfrom
JonathanBrouwer:rollup-1XmDOYn

Conversation

@JonathanBrouwer

Copy link
Copy Markdown
Member

Successful merges:

r? @ghost

Create a similar rollup

valentynkit and others added 30 commits July 30, 2026 16:39
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
@rust-bors rust-bors Bot added the rollup A PR which is a rollup label Sep 8, 2026
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Sep 8, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Member Author

@bors r+ p=5

Trying commonly failed jobs
@bors try jobs=dist-various-1,test-various,test-x86_64-gnu-aux,test-x86_64-gnu-llvm-21-3,test-x86_64-msvc-1,test-aarch64-apple-1,test-aarch64-apple-2,test-x86_64-mingw-1,test-i686-msvc-1,test-i686-msvc-2,test-armhf-gnu

@rust-bors

rust-bors Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 2cbdc87 has been approved by JonathanBrouwer

It is now in the queue for this repository.

@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 Sep 8, 2026
@rust-bors

rust-bors Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

⌛ Trying commit 2cbdc87 with merge dd8159a

To cancel the try build, run the command @bors try cancel.

Workflow: https://github.com/rust-lang/rust/actions/runs/34278899339

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
@rust-bors rust-bors Bot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 8, 2026
@rust-bors

rust-bors Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This pull request was unapproved due to being closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rollup A PR which is a rollup S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants