File tree 2 files changed +7
-0
lines changed 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -174,6 +174,7 @@ macro_rules! trailing_field_offset {
174
174
// allocation addressed by `ALIGNED_64K_ALLOCATION` is guaranteed to
175
175
// be aligned to `_64K`, so `ptr` is guaranteed to satisfy `$ty`'s
176
176
// alignment.
177
+ // - As required by `addr_of!`, we do not write through `field`.
177
178
//
178
179
// Note that, as of [2], this requirement is technically unnecessary
179
180
// for Rust versions >= 1.75.0, but no harm in guaranteeing it anyway
Original file line number Diff line number Diff line change @@ -228,7 +228,13 @@ impl<T> Unalign<T> {
228
228
/// documented as being sound to use with an unaligned pointer, such as
229
229
/// [`read_unaligned`].
230
230
///
231
+ /// Even if the caller is permitted to mutate `self` (e.g. they have
232
+ /// ownership or a mutable borrow), it is not guaranteed to be sound to
233
+ /// write through the returned pointer. If writing is required, prefer
234
+ /// [`get_mut_ptr`] instead.
235
+ ///
231
236
/// [`read_unaligned`]: core::ptr::read_unaligned
237
+ /// [`get_mut_ptr`]: Unalign::get_mut_ptr
232
238
#[ inline( always) ]
233
239
pub const fn get_ptr ( & self ) -> * const T {
234
240
ptr:: addr_of!( self . 0 )
You can’t perform that action at this time.
0 commit comments