diff options
| author | bors <bors@rust-lang.org> | 2025-07-26 10:12:14 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2025-07-26 10:12:14 +0000 |
| commit | 8708f3cd1f96d226f6420a58ebdd61aa0bc08b0a (patch) | |
| tree | 865b4c9c9a70184f93a3e15b750b90c446077700 /library/std/src/thread/mod.rs | |
| parent | 051d0e8a957c98f87ddaf6295c3a3ecd88742ff9 (diff) | |
| parent | 39141d01f15b4b16566816058bdfab22831cc4e5 (diff) | |
| download | rust-8708f3cd1f96d226f6420a58ebdd61aa0bc08b0a.tar.gz rust-8708f3cd1f96d226f6420a58ebdd61aa0bc08b0a.zip | |
Auto merge of #144490 - tgross35:rollup-ps0utme, r=tgross35
Rollup of 9 pull requests Successful merges: - rust-lang/rust#140871 (Don't lint against named labels in `naked_asm!`) - rust-lang/rust#141663 (rustdoc: add ways of collapsing all impl blocks) - rust-lang/rust#143272 (Upgrade the `fortanix-sgx-abi` dependency) - rust-lang/rust#143585 (`loop_match`: suggest extracting to a `const` item) - rust-lang/rust#143698 (Fix unused_parens false positive) - rust-lang/rust#143859 (Guarantee 8 bytes of alignment in Thread::into_raw) - rust-lang/rust#144160 (tests: debuginfo: Work around or disable broken tests on powerpc) - rust-lang/rust#144412 (Small cleanup: Use LocalKey<Cell> methods more) - rust-lang/rust#144431 (Disable has_reliable_f128_math on musl targets) r? `@ghost` `@rustbot` modify labels: rollup
Diffstat (limited to 'library/std/src/thread/mod.rs')
| -rw-r--r-- | library/std/src/thread/mod.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/library/std/src/thread/mod.rs b/library/std/src/thread/mod.rs index 6075173db47..8cd1e0163a1 100644 --- a/library/std/src/thread/mod.rs +++ b/library/std/src/thread/mod.rs @@ -1399,6 +1399,11 @@ where } /// The internal representation of a `Thread` handle +/// +/// We explicitly set the alignment for our guarantee in Thread::into_raw. This +/// allows applications to stuff extra metadata bits into the alignment, which +/// can be rather useful when working with atomics. +#[repr(align(8))] struct Inner { name: Option<ThreadNameString>, id: ThreadId, @@ -1582,7 +1587,8 @@ impl Thread { /// Consumes the `Thread`, returning a raw pointer. /// /// To avoid a memory leak the pointer must be converted - /// back into a `Thread` using [`Thread::from_raw`]. + /// back into a `Thread` using [`Thread::from_raw`]. The pointer is + /// guaranteed to be aligned to at least 8 bytes. /// /// # Examples /// |
