mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-02 19:06:05 +00:00
remove extra type parameter from ptr::is_null() and friends
This commit is contained in:
parent
358dc59538
commit
f4cc5ff226
@ -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]
|
||||
|
9
src/test/run-pass/ptr-is-null.rs
Normal file
9
src/test/run-pass/ptr-is-null.rs
Normal 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();
|
||||
}
|
Loading…
Reference in New Issue
Block a user