Skip to content

Commit 2f60850

Browse files
committed
---
yaml --- r: 15305 b: refs/heads/try c: 3b8097d h: refs/heads/master i: 15303: 180801a v: v3
1 parent 7d8a1f4 commit 2f60850

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: e325146eb436c4995385d8220ff7ac3a4a5f62ab
5+
refs/heads/try: 3b8097daccf2d0d4da78f4ca0f98aa2043dea299
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libcore/ptr.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ fn mut_offset<T>(ptr: *mut T, count: uint) -> *mut T {
4949

5050
#[doc = "Create an unsafe null pointer"]
5151
#[inline(always)]
52-
fn null<T>() -> *T unsafe { ret unsafe::reinterpret_cast(0u); }
52+
pure fn null<T>() -> *T unsafe { ret unsafe::reinterpret_cast(0u); }
53+
54+
#[doc = "Returns true if the pointer is equal to the null pointer"]
55+
pure fn is_null<T>(ptr: *const T) -> bool { ptr == null() }
56+
57+
#[doc = "Returns true if the pointer is not equal to the null pointer"]
58+
pure fn is_not_null<T>(ptr: *const T) -> bool { !is_null(ptr) }
5359

5460
#[doc = "
5561
Copies data from one location to another

0 commit comments

Comments
 (0)