diff options
| author | Niko Matsakis <niko@alum.mit.edu> | 2012-08-27 16:08:17 -0700 |
|---|---|---|
| committer | Niko Matsakis <niko@alum.mit.edu> | 2012-08-27 19:56:16 -0700 |
| commit | 0a01d82f6f3e33ca742c8e985d2a4819faeafe40 (patch) | |
| tree | e6a3bfdfac3be000e62bcb2f5c8b3e1acbdc7a45 /src/libcore/ptr.rs | |
| parent | ff513b1bcd0d872899b453cb3542e7a0924d5bde (diff) | |
| download | rust-0a01d82f6f3e33ca742c8e985d2a4819faeafe40.tar.gz rust-0a01d82f6f3e33ca742c8e985d2a4819faeafe40.zip | |
preliminary work on making future's sendable
also various improvements to the ptr casting fns: - rename assimilate() to to_unsafe_ptr() (fixes #3110) - introduce `unsafe::copy_lifetime()` to copy the lifetime from one ptr to another
Diffstat (limited to 'src/libcore/ptr.rs')
| -rw-r--r-- | src/libcore/ptr.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs index 5e3b49da483..2a99ce3f3d6 100644 --- a/src/libcore/ptr.rs +++ b/src/libcore/ptr.rs @@ -1,7 +1,7 @@ //! Unsafe pointer utility functions export addr_of; -export assimilate; +export to_unsafe_ptr; export mut_addr_of; export offset; export const_offset; @@ -136,9 +136,10 @@ unsafe fn memset<T>(dst: *mut T, c: int, count: uint) { ("assimilate" because it makes the pointer forget its region.) */ #[inline(always)] -fn assimilate<T>(thing: &T) -> *T unsafe { +fn to_unsafe_ptr<T>(thing: &T) -> *T unsafe { unsafe::reinterpret_cast(thing) } + /** Cast a region pointer - &T - to a uint. This is safe, but is implemented with an unsafe block due to |
