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
This commit is contained in:
Niko Matsakis
2012-08-27 16:08:17 -07:00
parent ff513b1bcd
commit 0a01d82f6f
4 changed files with 89 additions and 29 deletions

View File

@@ -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