-
Notifications
You must be signed in to change notification settings - Fork 124
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
From what I can tell, it's not exercised anywhere in the codebase.
Ptr::read_unaligned
permits reading from a shared pointer through UnsafeCell
s:
Lines 35 to 53 in 7349fe0
impl<'a, T, Aliasing, Alignment> MaybeAligned<'a, T, Aliasing, Alignment> | |
where | |
T: 'a + ?Sized, | |
Aliasing: invariant::Aliasing + invariant::AtLeast<invariant::Shared>, | |
Alignment: invariant::Alignment, | |
{ | |
/// Reads the value from `MaybeAligned`. | |
#[must_use] | |
#[inline] | |
pub fn read_unaligned(self) -> T | |
where | |
T: Copy, | |
{ | |
let raw = self.as_non_null().as_ptr(); | |
// SAFETY: By invariant on `MaybeAligned`, `raw` contains | |
// validly-initialized data for `T`. The value is safe to read and | |
// return, because `T` is copy. | |
unsafe { core::ptr::read_unaligned(raw) } | |
} |
We should either add an Immutable
bound or an AliasingSafe
bound.
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working