Skip to content

Commit

Permalink
auto merge of #6913 : thestinger/rust/ptr, r=graydon
Browse files Browse the repository at this point in the history
Closes #6607

I went with `RawPtr` instead of `UnsafePtr` because not all of these operations are `unsafe`, so to me it makes more sense to refer to it as a "raw" (not wrapped/abstracted) pointer. If we decide on something else in #6608 it can be renamed again.
  • Loading branch information
bors committed Jun 3, 2013
2 parents 4f6285f + e900dba commit 5ddbc88
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/libstd/pipes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ use option::{None, Option, Some};
use unstable::finally::Finally;
use unstable::intrinsics;
use ptr;
use ptr::Ptr;
use ptr::RawPtr;
use task;
use vec;
use vec::OwnedVector;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub use path::GenericPath;
pub use path::Path;
pub use path::PosixPath;
pub use path::WindowsPath;
pub use ptr::Ptr;
pub use ptr::RawPtr;
pub use ascii::{Ascii, AsciiCast, OwnedAsciiCast, AsciiStr};
pub use str::{StrVector, StrSlice, OwnedStr, StrUtil};
pub use from_str::{FromStr};
Expand Down
6 changes: 3 additions & 3 deletions src/libstd/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ pub unsafe fn array_each<T>(arr: **T, cb: &fn(*T)) {
}

#[allow(missing_doc)]
pub trait Ptr<T> {
pub trait RawPtr<T> {
fn is_null(&const self) -> bool;
fn is_not_null(&const self) -> bool;
unsafe fn to_option(&const self) -> Option<&T>;
fn offset(&self, count: uint) -> Self;
}

/// Extension methods for immutable pointers
impl<T> Ptr<T> for *T {
impl<T> RawPtr<T> for *T {
/// Returns true if the pointer is equal to the null pointer.
#[inline(always)]
fn is_null(&const self) -> bool { is_null(*self) }
Expand Down Expand Up @@ -336,7 +336,7 @@ impl<T> Ptr<T> for *T {
}

/// Extension methods for mutable pointers
impl<T> Ptr<T> for *mut T {
impl<T> RawPtr<T> for *mut T {
/// Returns true if the pointer is equal to the null pointer.
#[inline(always)]
fn is_null(&const self) -> bool { is_null(*self) }
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/rt/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Several modules in `core` are clients of `rt`:

#[doc(hidden)];

use ptr::Ptr;
use ptr::RawPtr;

/// The global (exchange) heap.
pub mod global_heap;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/rt/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// except according to those terms.

use container::Container;
use ptr::Ptr;
use ptr::RawPtr;
use vec;
use ops::Drop;
use libc::{c_uint, uintptr_t};
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/rt/uv/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use container::Container;
use option::*;
use str::raw::from_c_str;
use to_str::ToStr;
use ptr::Ptr;
use ptr::RawPtr;
use libc;
use vec;
use ptr;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/str.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use libc;
use option::{None, Option, Some};
use old_iter::{BaseIter, EqIter};
use ptr;
use ptr::Ptr;
use ptr::RawPtr;
use str;
use to_str::ToStr;
use uint;
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ use old_iter::CopyableIter;
use option::{None, Option, Some};
use ptr::to_unsafe_ptr;
use ptr;
use ptr::Ptr;
use ptr::RawPtr;
use sys;
use uint;
use unstable::intrinsics;
Expand Down

0 comments on commit 5ddbc88

Please sign in to comment.