diff options
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/rc.rs | 4 | ||||
| -rw-r--r-- | src/liballoc/sync.rs | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 1d2222adb9d..751efe0e71e 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -259,6 +259,10 @@ use crate::vec::Vec; #[cfg(test)] mod tests; +// This is repr(C) to future-proof against possible field-reordering, which +// would interfere with otherwise safe [into|from]_raw() of transmutable +// inner types. +#[repr(C)] struct RcBox<T: ?Sized> { strong: Cell<usize>, weak: Cell<usize>, diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index f9c8da58c75..b44d78f31ec 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -270,6 +270,10 @@ impl<T: ?Sized + fmt::Debug> fmt::Debug for Weak<T> { } } +// This is repr(C) to future-proof against possible field-reordering, which +// would interfere with otherwise safe [into|from]_raw() of transmutable +// inner types. +#[repr(C)] struct ArcInner<T: ?Sized> { strong: atomic::AtomicUsize, |
