From 54452cdd68a18b7caa8def20bbd587b769f4cb67 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 19 Dec 2014 08:57:12 -0800 Subject: std: Second pass stabilization for `ptr` This commit performs a second pass for stabilization over the `std::ptr` module. The specific actions taken were: * The `RawPtr` trait was renamed to `PtrExt` * The `RawMutPtr` trait was renamed to `MutPtrExt` * The module name `ptr` is now stable. * These functions were all marked `#[stable]` with no modification: * `null` * `null_mut` * `swap` * `replace` * `read` * `write` * `PtrExt::is_null` * `PtrExt::offset` * These functions remain unstable: * `as_ref`, `as_mut` - the return value of an `Option` is not fully expressive as null isn't the only bad value, and it's unclear whether we want to commit to these functions at this time. The reference/lifetime semantics as written are also problematic in how they encourage arbitrary lifetimes. * `zero_memory` - This function is currently not used at all in the distribution, and in general it plays a broader role in the "working with unsafe pointers" story. This story is not yet fully developed, so at this time the function remains unstable for now. * `read_and_zero` - This function remains unstable for largely the same reasons as `zero_memory`. * These functions are now all deprecated: * `PtrExt::null` - call `ptr::null` or `ptr::null_mut` instead. * `PtrExt::to_uint` - use an `as` expression instead. * `PtrExt::is_not_null` - use `!p.is_null()` instead. --- src/liballoc/arc.rs | 2 +- src/liballoc/heap.rs | 4 ++-- src/liballoc/rc.rs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src/liballoc') diff --git a/src/liballoc/arc.rs b/src/liballoc/arc.rs index 3e235caab18..eecc0769bd7 100644 --- a/src/liballoc/arc.rs +++ b/src/liballoc/arc.rs @@ -80,7 +80,7 @@ use core::nonzero::NonZero; use core::ops::{Drop, Deref}; use core::option::Option; use core::option::Option::{Some, None}; -use core::ptr::{mod, RawPtr}; +use core::ptr::{mod, PtrExt}; use heap::deallocate; /// An atomically reference counted wrapper for shared state. diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index c6b6a784f06..cdc30efd2d9 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use core::ptr::RawPtr; +use core::ptr::PtrExt; // FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias` @@ -371,7 +371,7 @@ mod imp { mod test { extern crate test; use self::test::Bencher; - use core::ptr::RawPtr; + use core::ptr::PtrExt; use heap; #[test] diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 13dc4474c1a..90e126bef4d 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -154,7 +154,7 @@ use core::nonzero::NonZero; use core::ops::{Deref, Drop}; use core::option::Option; use core::option::Option::{Some, None}; -use core::ptr::{mod, RawPtr}; +use core::ptr::{mod, PtrExt}; use core::result::Result; use core::result::Result::{Ok, Err}; -- cgit 1.4.1-3-g733a5