File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -1380,6 +1380,11 @@ where
1380
1380
}
1381
1381
1382
1382
/// The internal representation of a `Thread` handle
1383
+ ///
1384
+ /// We explicitly set the alignment for our guarantee in Thread::into_raw. This
1385
+ /// allows applications to stuff extra metadata bits into the alignment, which
1386
+ /// can be rather useful when working with atomics.
1387
+ #[ repr( align( 8 ) ) ]
1383
1388
struct Inner {
1384
1389
name : Option < ThreadNameString > ,
1385
1390
id : ThreadId ,
@@ -1563,7 +1568,8 @@ impl Thread {
1563
1568
/// Consumes the `Thread`, returning a raw pointer.
1564
1569
///
1565
1570
/// To avoid a memory leak the pointer must be converted
1566
- /// back into a `Thread` using [`Thread::from_raw`].
1571
+ /// back into a `Thread` using [`Thread::from_raw`]. The pointer is
1572
+ /// guaranteed to be aligned to at least 8 bytes.
1567
1573
///
1568
1574
/// # Examples
1569
1575
///
You can’t perform that action at this time.
0 commit comments