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.
This commit is contained in:
parent
71123902e1
commit
54452cdd68
20 changed files with 119 additions and 92 deletions
|
|
@ -22,7 +22,7 @@ use num::Int;
|
|||
use ops::FnOnce;
|
||||
use option::Option;
|
||||
use option::Option::{Some, None};
|
||||
use ptr::RawPtr;
|
||||
use ptr::PtrExt;
|
||||
use result::Result::{Ok, Err};
|
||||
use slice::{SliceExt, AsSlice};
|
||||
|
||||
|
|
|
|||
|
|
@ -935,7 +935,7 @@ impl<'a> Reader for &'a mut (Reader+'a) {
|
|||
// API yet. If so, it should be a method on Vec.
|
||||
unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: uint, end: uint) -> &'a mut [T] {
|
||||
use raw::Slice;
|
||||
use ptr::RawPtr;
|
||||
use ptr::PtrExt;
|
||||
|
||||
assert!(start <= end);
|
||||
assert!(end <= v.capacity());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue