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:
parent
e50580aa66
commit
b8bb663df7
9 changed files with 25 additions and 37 deletions
|
|
@ -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); }
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue