Skip to content

Commit 5c61183

Browse files
committed
Document that there are many possible null pointers
1 parent 8b2e09f commit 5c61183

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/libcore/ptr.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,11 @@ pub unsafe fn write_volatile<T>(dst: *mut T, src: T) {
476476
impl<T: ?Sized> *const T {
477477
/// Returns `true` if the pointer is null.
478478
///
479+
/// Note that unsized types have many possible null pointers, as only the
480+
/// raw data pointer is considered, not their length, vtable, etc.
481+
/// Therefore, two pointers that are null may still not compare equal to
482+
/// each other.
483+
///
479484
/// # Examples
480485
///
481486
/// Basic usage:
@@ -1109,6 +1114,11 @@ impl<T: ?Sized> *const T {
11091114
impl<T: ?Sized> *mut T {
11101115
/// Returns `true` if the pointer is null.
11111116
///
1117+
/// Note that unsized types have many possible null pointers, as only the
1118+
/// raw data pointer is considered, not their length, vtable, etc.
1119+
/// Therefore, two pointers that are null may still not compare equal to
1120+
/// each other.
1121+
///
11121122
/// # Examples
11131123
///
11141124
/// Basic usage:

0 commit comments

Comments
 (0)