about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-05-03 15:12:04 -0400
committerNiko Matsakis <niko@alum.mit.edu>2013-05-03 15:12:04 -0400
commitf3a6ea26437e240b02d749331b3a2d60aab0588b (patch)
tree2db7a5c48bd0f312a70e9f356382cef30b99ab85
parente7d96934c16c915d18be391836fbf0ebca6c558b (diff)
downloadrust-f3a6ea26437e240b02d749331b3a2d60aab0588b.tar.gz
rust-f3a6ea26437e240b02d749331b3a2d60aab0588b.zip
lang: um, actually set locking bits! this code got lost.
-rw-r--r--src/libcore/unstable/lang.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libcore/unstable/lang.rs b/src/libcore/unstable/lang.rs
index 27fc3287bdb..01ab2345918 100644
--- a/src/libcore/unstable/lang.rs
+++ b/src/libcore/unstable/lang.rs
@@ -235,6 +235,8 @@ pub unsafe fn borrow_as_imm(a: *u8, file: *c_char, line: size_t) -> uint {
         fail_borrowed(a, file, line);
     }
 
+    (*a).header.ref_count = ref_count | FROZEN_BIT;
+
     ref_count
 }
 
@@ -251,6 +253,9 @@ pub unsafe fn borrow_as_mut(a: *u8, file: *c_char, line: size_t) -> uint {
     if (ref_count & (MUT_BIT|FROZEN_BIT)) != 0 {
         fail_borrowed(a, file, line);
     }
+
+    (*a).header.ref_count = ref_count | MUT_BIT | FROZEN_BIT;
+
     ref_count
 }
 
@@ -349,7 +354,12 @@ pub unsafe fn check_not_borrowed(a: *u8,
                                  file: *c_char,
                                  line: size_t) {
     let a: *mut BoxRepr = transmute(a);
-    if ((*a).header.ref_count & FROZEN_BIT) != 0 {
+    let ref_count = (*a).header.ref_count;
+    debug_ptr("check_not_borrowed (ptr) : ", a);
+    debug_ptr("                   (line): ", line as *());
+    debug_ptr("                   (rc)  : ", ref_count as *());
+
+    if (ref_count & FROZEN_BIT) != 0 {
         fail_borrowed(a, file, line);
     }
 }