We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e1f8d18 commit 5f90525Copy full SHA for 5f90525
src/lib.rs
@@ -152,6 +152,11 @@ impl<T> RingBuffer<T> {
152
let ptr: *mut [T] = core::ptr::slice_from_raw_parts_mut(ptr.cast(), capacity);
153
// ... and coerce it into our own dynamically sized type:
154
let ptr = ptr as *mut Self;
155
+
156
+ // Since Rust 1.51 addr_of_mut!((*ptr).$field_name).write(...) can be used
157
+ // to get a properly typed (and aligned) pointer for field initialization
158
+ // (instead of manually casting from `*mut u8`).
159
160
// Safety: Null check has been done above
161
NonNull::new_unchecked(ptr)
162
};
0 commit comments