about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/gc.rs102
-rw-r--r--src/libcore/pipes.rs4
-rw-r--r--src/libcore/rt/sched/local_sched.rs6
-rw-r--r--src/libcore/rt/uvio.rs3
-rw-r--r--src/libcore/rt/uvll.rs4
-rw-r--r--src/libcore/str/ascii.rs1
-rw-r--r--src/libcore/unstable.rs20
-rw-r--r--src/libcore/unstable/weak_task.rs4
8 files changed, 69 insertions, 75 deletions
diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs
index 71d9ab439f3..a6bae3c7663 100644
--- a/src/libcore/gc.rs
+++ b/src/libcore/gc.rs
@@ -231,66 +231,64 @@ unsafe fn walk_gc_roots(mem: Memory, sentinel: **Word, visitor: Visitor) {
     // the stack.
     let mut reached_sentinel = ptr::is_null(sentinel);
     for stackwalk::walk_stack |frame| {
-        unsafe {
-            let pc = last_ret;
-            let Segment {segment: next_segment, boundary: boundary} =
-                find_segment_for_frame(frame.fp, segment);
-            segment = next_segment;
-            // Each stack segment is bounded by a morestack frame. The
-            // morestack frame includes two return addresses, one for
-            // morestack itself, at the normal offset from the frame
-            // pointer, and then a second return address for the
-            // function prologue (which called morestack after
-            // determining that it had hit the end of the stack).
-            // Since morestack itself takes two parameters, the offset
-            // for this second return address is 3 greater than the
-            // return address for morestack.
-            let ret_offset = if boundary { 4 } else { 1 };
-            last_ret = *ptr::offset(frame.fp, ret_offset) as *Word;
-
-            if ptr::is_null(pc) {
-                loop;
-            }
+        let pc = last_ret;
+        let Segment {segment: next_segment, boundary: boundary} =
+            find_segment_for_frame(frame.fp, segment);
+        segment = next_segment;
+        // Each stack segment is bounded by a morestack frame. The
+        // morestack frame includes two return addresses, one for
+        // morestack itself, at the normal offset from the frame
+        // pointer, and then a second return address for the
+        // function prologue (which called morestack after
+        // determining that it had hit the end of the stack).
+        // Since morestack itself takes two parameters, the offset
+        // for this second return address is 3 greater than the
+        // return address for morestack.
+        let ret_offset = if boundary { 4 } else { 1 };
+        last_ret = *ptr::offset(frame.fp, ret_offset) as *Word;
+
+        if ptr::is_null(pc) {
+            loop;
+        }
 
-            let mut delay_reached_sentinel = reached_sentinel;
-            let sp = is_safe_point(pc);
-            match sp {
-              Some(sp_info) => {
-                for walk_safe_point(frame.fp, sp_info) |root, tydesc| {
-                    // Skip roots until we see the sentinel.
-                    if !reached_sentinel {
-                        if root == sentinel {
-                            delay_reached_sentinel = true;
-                        }
-                        loop;
+        let mut delay_reached_sentinel = reached_sentinel;
+        let sp = is_safe_point(pc);
+        match sp {
+          Some(sp_info) => {
+            for walk_safe_point(frame.fp, sp_info) |root, tydesc| {
+                // Skip roots until we see the sentinel.
+                if !reached_sentinel {
+                    if root == sentinel {
+                        delay_reached_sentinel = true;
                     }
+                    loop;
+                }
 
-                    // Skip null pointers, which can occur when a
-                    // unique pointer has already been freed.
-                    if ptr::is_null(*root) {
-                        loop;
-                    }
+                // Skip null pointers, which can occur when a
+                // unique pointer has already been freed.
+                if ptr::is_null(*root) {
+                    loop;
+                }
 
-                    if ptr::is_null(tydesc) {
-                        // Root is a generic box.
-                        let refcount = **root;
-                        if mem | task_local_heap != 0 && refcount != -1 {
-                            if !visitor(root, tydesc) { return; }
-                        } else if mem | exchange_heap != 0 && refcount == -1 {
-                            if !visitor(root, tydesc) { return; }
-                        }
-                    } else {
-                        // Root is a non-immediate.
-                        if mem | stack != 0 {
-                            if !visitor(root, tydesc) { return; }
-                        }
+                if ptr::is_null(tydesc) {
+                    // Root is a generic box.
+                    let refcount = **root;
+                    if mem | task_local_heap != 0 && refcount != -1 {
+                        if !visitor(root, tydesc) { return; }
+                    } else if mem | exchange_heap != 0 && refcount == -1 {
+                        if !visitor(root, tydesc) { return; }
+                    }
+                } else {
+                    // Root is a non-immediate.
+                    if mem | stack != 0 {
+                        if !visitor(root, tydesc) { return; }
                     }
                 }
-              }
-              None => ()
             }
-            reached_sentinel = delay_reached_sentinel;
+          }
+          None => ()
         }
+        reached_sentinel = delay_reached_sentinel;
     }
 }
 
diff --git a/src/libcore/pipes.rs b/src/libcore/pipes.rs
index 36cfdbf5617..2ec3afca612 100644
--- a/src/libcore/pipes.rs
+++ b/src/libcore/pipes.rs
@@ -156,9 +156,7 @@ pub impl PacketHeader {
     unsafe fn unblock(&self) {
         let old_task = swap_task(&mut self.blocked_task, ptr::null());
         if !old_task.is_null() {
-            unsafe {
-                rustrt::rust_task_deref(old_task)
-            }
+            rustrt::rust_task_deref(old_task)
         }
         match swap_state_acq(&mut self.state, Empty) {
           Empty | Blocked => (),
diff --git a/src/libcore/rt/sched/local_sched.rs b/src/libcore/rt/sched/local_sched.rs
index 77fbadf0bb7..2d1e06163be 100644
--- a/src/libcore/rt/sched/local_sched.rs
+++ b/src/libcore/rt/sched/local_sched.rs
@@ -80,10 +80,8 @@ pub unsafe fn unsafe_borrow() -> &mut Scheduler {
 }
 
 pub unsafe fn unsafe_borrow_io() -> &mut IoFactoryObject {
-    unsafe {
-        let sched = unsafe_borrow();
-        return sched.event_loop.io().unwrap();
-    }
+    let sched = unsafe_borrow();
+    return sched.event_loop.io().unwrap();
 }
 
 fn tls_key() -> tls::Key {
diff --git a/src/libcore/rt/uvio.rs b/src/libcore/rt/uvio.rs
index 7bf1792baf4..abdd8d6619a 100644
--- a/src/libcore/rt/uvio.rs
+++ b/src/libcore/rt/uvio.rs
@@ -11,7 +11,7 @@
 use option::*;
 use result::*;
 
-use super::io::net::ip::{IpAddr, Ipv4}; // n.b. Ipv4 is used only in tests
+use super::io::net::ip::IpAddr;
 use super::uv::*;
 use super::rtio::*;
 use ops::Drop;
@@ -19,6 +19,7 @@ use cell::{Cell, empty_cell};
 use cast::transmute;
 use super::sched::{Scheduler, local_sched};
 
+#[cfg(test)] use super::io::net::ip::Ipv4;
 #[cfg(test)] use super::sched::Task;
 #[cfg(test)] use unstable::run_in_bare_thread;
 #[cfg(test)] use uint;
diff --git a/src/libcore/rt/uvll.rs b/src/libcore/rt/uvll.rs
index 640a69743ba..b7eff217ff8 100644
--- a/src/libcore/rt/uvll.rs
+++ b/src/libcore/rt/uvll.rs
@@ -98,7 +98,7 @@ pub enum uv_req_type {
 
 pub unsafe fn malloc_handle(handle: uv_handle_type) -> *c_void {
     assert!(handle != UV_UNKNOWN_HANDLE && handle != UV_HANDLE_TYPE_MAX);
-    let size = unsafe { rust_uv_handle_size(handle as uint) };
+    let size = rust_uv_handle_size(handle as uint);
     let p = malloc(size);
     assert!(p.is_not_null());
     return p;
@@ -110,7 +110,7 @@ pub unsafe fn free_handle(v: *c_void) {
 
 pub unsafe fn malloc_req(req: uv_req_type) -> *c_void {
     assert!(req != UV_UNKNOWN_REQ && req != UV_REQ_TYPE_MAX);
-    let size = unsafe { rust_uv_req_size(req as uint) };
+    let size = rust_uv_req_size(req as uint);
     let p = malloc(size);
     assert!(p.is_not_null());
     return p;
diff --git a/src/libcore/str/ascii.rs b/src/libcore/str/ascii.rs
index 339274ab47e..f6c0176eafc 100644
--- a/src/libcore/str/ascii.rs
+++ b/src/libcore/str/ascii.rs
@@ -196,6 +196,7 @@ impl ToStrConsume for ~[Ascii] {
     }
 }
 
+#[cfg(test)]
 mod tests {
     use super::*;
 
diff --git a/src/libcore/unstable.rs b/src/libcore/unstable.rs
index a6bb93c20cd..4a69de26f6b 100644
--- a/src/libcore/unstable.rs
+++ b/src/libcore/unstable.rs
@@ -262,18 +262,16 @@ pub impl<T:Owned> Exclusive<T> {
     // the exclusive. Supporting that is a work in progress.
     #[inline(always)]
     unsafe fn with<U>(&self, f: &fn(x: &mut T) -> U) -> U {
-        unsafe {
-            let rec = get_shared_mutable_state(&self.x);
-            do (*rec).lock.lock {
-                if (*rec).failed {
-                    fail!(
-                        ~"Poisoned exclusive - another task failed inside!");
-                }
-                (*rec).failed = true;
-                let result = f(&mut (*rec).data);
-                (*rec).failed = false;
-                result
+        let rec = get_shared_mutable_state(&self.x);
+        do (*rec).lock.lock {
+            if (*rec).failed {
+                fail!(
+                    ~"Poisoned exclusive - another task failed inside!");
             }
+            (*rec).failed = true;
+            let result = f(&mut (*rec).data);
+            (*rec).failed = false;
+            result
         }
     }
 
diff --git a/src/libcore/unstable/weak_task.rs b/src/libcore/unstable/weak_task.rs
index 4e2174fd5d2..7a30bb92111 100644
--- a/src/libcore/unstable/weak_task.rs
+++ b/src/libcore/unstable/weak_task.rs
@@ -43,11 +43,11 @@ pub unsafe fn weaken_task(f: &fn(Port<ShutdownMsg>)) {
     let task = get_task_id();
     // Expect the weak task service to be alive
     assert!(service.try_send(RegisterWeakTask(task, shutdown_chan)));
-    unsafe { rust_dec_kernel_live_count(); }
+    rust_dec_kernel_live_count();
     do (|| {
         f(shutdown_port.take())
     }).finally || {
-        unsafe { rust_inc_kernel_live_count(); }
+        rust_inc_kernel_live_count();
         // Service my have already exited
         service.send(UnregisterWeakTask(task));
     }