viirya commented on code in PR #3289:
URL: https://github.com/apache/arrow-rs/pull/3289#discussion_r1043738826


##########
arrow-buffer/src/alloc/mod.rs:
##########
@@ -28,9 +28,18 @@ mod alignment;
 
 pub use alignment::ALIGNMENT;
 
+/// Returns an aligned non null pointer similar to [`NonNull::dangling`]
+///
+/// Note that the pointer value may potentially represent a valid pointer, 
which means
+/// this must not be used as a "not yet initialized" sentinel value.
+///
+/// Types that lazily allocate must track initialization by some other means.
 #[inline]
-unsafe fn null_pointer() -> NonNull<u8> {
-    NonNull::new_unchecked(ALIGNMENT as *mut u8)
+fn dangling() -> NonNull<u8> {
+    // SAFETY: ALIGNMENT is a non-zero usize which is then casted
+    // to a *mut T. Therefore, `ptr` is not null and the conditions for

Review Comment:
   nit: there is no `ptr` so might be confused for some readers.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to