core: Inherit the ptr module
This commit is contained in:
parent
dca8a0d6e4
commit
645b157564
@ -25,3 +25,4 @@
|
||||
|
||||
pub mod intrinsics;
|
||||
pub mod mem;
|
||||
pub mod ptr;
|
||||
|
@ -92,14 +92,12 @@
|
||||
|
||||
use cast;
|
||||
use clone::Clone;
|
||||
#[cfg(not(test))]
|
||||
use cmp::Equiv;
|
||||
use intrinsics;
|
||||
use iter::{range, Iterator};
|
||||
use mem;
|
||||
use option::{Option, Some, None};
|
||||
use intrinsics;
|
||||
use option::{Some, None, Option};
|
||||
|
||||
#[cfg(not(test))] use cmp::{Eq, TotalEq, Ord};
|
||||
#[cfg(not(test))] use cmp::{Eq, TotalEq, Ord, Equiv};
|
||||
|
||||
/// Return the offset of the first null pointer in `buf`.
|
||||
#[inline]
|
||||
@ -377,7 +375,9 @@ impl<T> RawPtr<T> for *mut T {
|
||||
fn to_uint(&self) -> uint { *self as uint }
|
||||
|
||||
#[inline]
|
||||
unsafe fn offset(self, count: int) -> *mut T { intrinsics::offset(self as *T, count) as *mut T }
|
||||
unsafe fn offset(self, count: int) -> *mut T {
|
||||
intrinsics::offset(self as *T, count) as *mut T
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn to_option(&self) -> Option<&T> {
|
||||
@ -444,10 +444,6 @@ mod externfnpointers {
|
||||
let other_: *() = unsafe { cast::transmute(*other) };
|
||||
self_ == other_
|
||||
}
|
||||
#[inline]
|
||||
fn ne(&self, other: &extern "C" fn() -> _R) -> bool {
|
||||
!self.eq(other)
|
||||
}
|
||||
}
|
||||
macro_rules! fnptreq(
|
||||
($($p:ident),*) => {
|
||||
@ -458,10 +454,6 @@ mod externfnpointers {
|
||||
let other_: *() = unsafe { cast::transmute(*other) };
|
||||
self_ == other_
|
||||
}
|
||||
#[inline]
|
||||
fn ne(&self, other: &extern "C" fn($($p),*) -> _R) -> bool {
|
||||
!self.eq(other)
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
@ -476,41 +468,13 @@ mod externfnpointers {
|
||||
#[cfg(not(test))]
|
||||
impl<T> Ord for *T {
|
||||
#[inline]
|
||||
fn lt(&self, other: &*T) -> bool {
|
||||
*self < *other
|
||||
}
|
||||
#[inline]
|
||||
fn le(&self, other: &*T) -> bool {
|
||||
*self <= *other
|
||||
}
|
||||
#[inline]
|
||||
fn ge(&self, other: &*T) -> bool {
|
||||
*self >= *other
|
||||
}
|
||||
#[inline]
|
||||
fn gt(&self, other: &*T) -> bool {
|
||||
*self > *other
|
||||
}
|
||||
fn lt(&self, other: &*T) -> bool { *self < *other }
|
||||
}
|
||||
|
||||
#[cfg(not(test))]
|
||||
impl<T> Ord for *mut T {
|
||||
#[inline]
|
||||
fn lt(&self, other: &*mut T) -> bool {
|
||||
*self < *other
|
||||
}
|
||||
#[inline]
|
||||
fn le(&self, other: &*mut T) -> bool {
|
||||
*self <= *other
|
||||
}
|
||||
#[inline]
|
||||
fn ge(&self, other: &*mut T) -> bool {
|
||||
*self >= *other
|
||||
}
|
||||
#[inline]
|
||||
fn gt(&self, other: &*mut T) -> bool {
|
||||
*self > *other
|
||||
}
|
||||
fn lt(&self, other: &*mut T) -> bool { *self < *other }
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
@ -135,6 +135,7 @@ extern crate core;
|
||||
|
||||
pub use core::intrinsics;
|
||||
pub use core::mem;
|
||||
pub use core::ptr;
|
||||
|
||||
// Run tests with libgreen instead of libnative.
|
||||
//
|
||||
@ -191,7 +192,7 @@ pub mod strbuf;
|
||||
|
||||
pub mod ascii;
|
||||
|
||||
pub mod ptr;
|
||||
pub mod owned;
|
||||
mod managed;
|
||||
mod reference;
|
||||
pub mod rc;
|
||||
|
Loading…
x
Reference in New Issue
Block a user