diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2014-12-19 08:57:12 -0800 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-12-29 15:57:28 -0800 |
| commit | 54452cdd68a18b7caa8def20bbd587b769f4cb67 (patch) | |
| tree | b9f02c5e33a125d26866516c9fe1c54d9c6072f0 /src/libcollections | |
| parent | 71123902e17ad339649f33423995eac78da40e3c (diff) | |
| download | rust-54452cdd68a18b7caa8def20bbd587b769f4cb67.tar.gz rust-54452cdd68a18b7caa8def20bbd587b769f4cb67.zip | |
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.
Diffstat (limited to 'src/libcollections')
| -rw-r--r-- | src/libcollections/dlist.rs | 2 | ||||
| -rw-r--r-- | src/libcollections/slice.rs | 2 | ||||
| -rw-r--r-- | src/libcollections/str.rs | 17 |
3 files changed, 7 insertions, 14 deletions
diff --git a/src/libcollections/dlist.rs b/src/libcollections/dlist.rs index f20b37cb60f..d8ce79f4fe9 100644 --- a/src/libcollections/dlist.rs +++ b/src/libcollections/dlist.rs @@ -95,7 +95,7 @@ impl<T> Rawlink<T> { /// Convert the `Rawlink` into an Option value fn resolve_immut<'a>(&self) -> Option<&'a T> { unsafe { - self.p.as_ref() + mem::transmute(self.p.as_ref()) } } diff --git a/src/libcollections/slice.rs b/src/libcollections/slice.rs index d6d94f57acf..d4db9ea59f9 100644 --- a/src/libcollections/slice.rs +++ b/src/libcollections/slice.rs @@ -96,7 +96,7 @@ use core::mem::size_of; use core::mem; use core::ops::FnMut; use core::prelude::{Clone, Greater, Iterator, IteratorExt, Less, None, Option}; -use core::prelude::{Ord, Ordering, RawPtr, Some, range}; +use core::prelude::{Ord, Ordering, PtrExt, Some, range}; use core::ptr; use core::slice as core_slice; use self::Direction::*; diff --git a/src/libcollections/str.rs b/src/libcollections/str.rs index 881eb45f7cc..225814673c4 100644 --- a/src/libcollections/str.rs +++ b/src/libcollections/str.rs @@ -1768,19 +1768,12 @@ impl StrExt for str {} #[cfg(test)] mod tests { - use std::iter::AdditiveIterator; - use std::iter::range; - use std::default::Default; - use std::char::Char; - use std::clone::Clone; - use std::cmp::{Ord, PartialOrd, Equiv}; - use std::cmp::Ordering::{Equal, Greater, Less}; - use std::option::Option::{mod, Some, None}; - use std::result::Result::{Ok, Err}; - use std::ptr::RawPtr; - use std::iter::{Iterator, IteratorExt, DoubleEndedIteratorExt}; + use prelude::*; - use super::*; + use core::default::Default; + use core::iter::AdditiveIterator; + use super::{eq_slice, from_utf8, is_utf8, is_utf16, raw}; + use super::truncate_utf16_at_nul; use super::MaybeOwned::{Owned, Slice}; use std::slice::{AsSlice, SliceExt}; use string::{String, ToString}; |
