Don't ever raise unique kinds of pinned kinds to shared (again)

So *resource, ~resource, [resource] are all pinned. This is counter to the
design of the kind system, but this way is a much clearer path to type safety.
Once we've established a good baseline with lots of tests, then we can try to
make raising pinned kinds work.
This commit is contained in:
Brian Anderson 2011-09-27 14:50:55 -07:00
parent e50580aa66
commit b8bb663df7
9 changed files with 25 additions and 37 deletions

View file

@ -5,9 +5,9 @@ native "rust-intrinsic" mod rusti {
fn ptr_offset<T>(ptr: *T, count: uint) -> *T;
}
fn addr_of<T>(val: T) -> *mutable T { ret rusti::addr_of(val); }
fn offset<T>(ptr: *T, count: uint) -> *T {
fn addr_of<@T>(val: T) -> *mutable T { ret rusti::addr_of(val); }
fn offset<@T>(ptr: *T, count: uint) -> *T {
ret rusti::ptr_offset(ptr, count);
}
fn null<T>() -> *T { ret unsafe::reinterpret_cast(0u); }
fn null<@T>() -> *T { ret unsafe::reinterpret_cast(0u); }

View file

@ -345,18 +345,18 @@ mod unsafe {
ret rustrt::vec_from_buf_shared(ptr, elts);
}
fn set_len<T>(&v: [T], new_len: uint) {
fn set_len<@T>(&v: [T], new_len: uint) {
let repr: **vec_repr = ::unsafe::reinterpret_cast(addr_of(v));
(**repr).fill = new_len * sys::size_of::<T>();
}
fn to_ptr<T>(v: [T]) -> *T {
fn to_ptr<@T>(v: [T]) -> *T {
let repr: **vec_repr = ::unsafe::reinterpret_cast(addr_of(v));
ret ::unsafe::reinterpret_cast(addr_of((**repr).data));
}
}
fn to_ptr<T>(v: [T]) -> *T { ret unsafe::to_ptr(v); }
fn to_ptr<@T>(v: [T]) -> *T { ret unsafe::to_ptr(v); }
// Local Variables:
// mode: rust;