From b8bb663df787511c6b91bf3182b59d140a9c8e02 Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Tue, 27 Sep 2011 14:50:55 -0700 Subject: 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. --- src/lib/ptr.rs | 6 +++--- src/lib/vec.rs | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/ptr.rs b/src/lib/ptr.rs index 8d730732c3c..ccb05f0ce29 100644 --- a/src/lib/ptr.rs +++ b/src/lib/ptr.rs @@ -5,9 +5,9 @@ native "rust-intrinsic" mod rusti { fn ptr_offset(ptr: *T, count: uint) -> *T; } -fn addr_of(val: T) -> *mutable T { ret rusti::addr_of(val); } -fn offset(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 { ret unsafe::reinterpret_cast(0u); } +fn null<@T>() -> *T { ret unsafe::reinterpret_cast(0u); } diff --git a/src/lib/vec.rs b/src/lib/vec.rs index 9b0e2a63091..3bb03afb483 100644 --- a/src/lib/vec.rs +++ b/src/lib/vec.rs @@ -345,18 +345,18 @@ mod unsafe { ret rustrt::vec_from_buf_shared(ptr, elts); } - fn set_len(&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::(); } - fn to_ptr(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(v: [T]) -> *T { ret unsafe::to_ptr(v); } +fn to_ptr<@T>(v: [T]) -> *T { ret unsafe::to_ptr(v); } // Local Variables: // mode: rust; -- cgit 1.4.1-3-g733a5