about summary refs log tree commit diff
path: root/src/libcore/sys.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-06-01 19:47:04 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-06-03 20:03:08 -0700
commit01b5777c8b6e4c3f580aa9e256de96b4b4b92739 (patch)
tree7166174a44a9f294fdaacc0c5bc447cafc482cea /src/libcore/sys.rs
parentb2ae333917c1ff0293fa93afa335e17608d0ca6e (diff)
prohibit type parameters in native fns and other minor fixes
trans now can safely assert that it never sees a type param
Diffstat (limited to 'src/libcore/sys.rs')
-rw-r--r--src/libcore/sys.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/libcore/sys.rs b/src/libcore/sys.rs
index be3bab6ac2e..93f204cb58f 100644
--- a/src/libcore/sys.rs
+++ b/src/libcore/sys.rs
@@ -17,9 +17,9 @@ enum type_desc = {
 
 #[abi = "cdecl"]
 native mod rustrt {
-    fn refcount<T>(t: @T) -> libc::intptr_t;
+    fn refcount(t: *()) -> libc::intptr_t;
     fn unsupervise();
-    fn shape_log_str<T>(t: *sys::type_desc, data: T) -> str;
+    fn shape_log_str(t: *sys::type_desc, data: *()) -> str;
 }
 
 #[abi = "rust-intrinsic"]
@@ -62,11 +62,16 @@ fn pref_align_of<T>() -> uint unsafe {
 
 #[doc = "Returns the refcount of a shared box"]
 fn refcount<T>(t: @T) -> uint {
-    ret rustrt::refcount::<T>(t) as uint;
+    unsafe {
+        ret rustrt::refcount(unsafe::reinterpret_cast(t)) as uint;
+    }
 }
 
 fn log_str<T>(t: T) -> str {
-    rustrt::shape_log_str(get_type_desc::<T>(), t)
+    unsafe {
+        let data_ptr: *() = unsafe::reinterpret_cast(ptr::addr_of(t));
+        rustrt::shape_log_str(get_type_desc::<T>(), data_ptr)
+    }
 }
 
 #[cfg(test)]