Rollup of 9 pull requests - #162503
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
…d, r=Kobzol Reserve items in `Extend` implementations This might be a perf win, inspired by @Kobzol's approach in this PR: rust-lang#162480
…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
|
@bors r+ p=5 |
This comment has been minimized.
This comment has been minimized.
What is this?This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.Comparing 4aa1fbc (parent) -> 0d31508 (this PR) Test differencesShow 147 test diffsStage 1
Stage 2
Additionally, 110 doctest diffs were found. These are ignored, as they are noisy. Job group index
Test dashboardRun cargo run --manifest-path src/ci/citool/Cargo.toml -- \
test-dashboard 0d31508599a7814a7044e9a7a871e3dc5f037753 --output-dir test-dashboardAnd then open Job duration changes
How to interpret the job duration changes?Job durations can vary a lot, based on the actual runner instance |
|
Finished benchmarking commit (0d31508): comparison URL. Overall result: no relevant changes - no action needed@rustbot label: -perf-regression Instruction countThis perf run didn't have relevant results for this metric. Max RSS (memory usage)Results (primary 0.5%, secondary 1.6%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesResults (primary -0.3%, secondary -3.4%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Binary sizeResults (primary 0.1%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 483.174s -> 480.949s (-0.46%) |
|
📌 Perf builds for each rolled up PR:
parent commit: 4aa1fbcf46 In the case of a perf regression, run the following command for each PR you suspect might be the cause: |
Successful merges:
Thread::os_id#160219 (ImplementThread::os_id)self-in-const-genericstest for parallel frontend #162494 (Ignoreself-in-const-genericstest for parallel frontend)Extendimplementations #162495 (Reserve items inExtendimplementations)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