remove extra type parameter from ptr::is_null() and friends

This commit is contained in:
Niko Matsakis 2012-05-02 21:12:16 -07:00
parent 358dc59538
commit f4cc5ff226
2 changed files with 11 additions and 2 deletions

View File

@ -104,10 +104,10 @@ unsafe fn memmove<T>(dst: *T, src: *T, count: uint) {
#[doc = "Extension methods for pointers"]
impl extensions<T> for *T {
#[doc = "Returns true if the pointer is equal to the null pointer."]
pure fn is_null<T>() -> bool { is_null(self) }
pure fn is_null() -> bool { is_null(self) }
#[doc = "Returns true if the pointer is not equal to the null pointer."]
pure fn is_not_null<T>() -> bool { is_not_null(self) }
pure fn is_not_null() -> bool { is_not_null(self) }
}
#[test]

View File

@ -0,0 +1,9 @@
fn main() {
let p: *int = ptr::null();
assert p.is_null();
assert !p.is_not_null();
let q = ptr::offset(p, 1u);
assert !q.is_null();
assert q.is_not_null();
}