From 468d023fe94aadbdc7b7dc0a83d264ee2ae0d68a Mon Sep 17 00:00:00 2001 From: Brian Anderson Date: Sat, 17 Aug 2013 01:12:08 -0700 Subject: [PATCH] std: Convert some assert!s to rtassert! --- src/libstd/rt/comm.rs | 9 +++++---- src/libstd/rt/sched.rs | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/libstd/rt/comm.rs b/src/libstd/rt/comm.rs index 8ef9c1332f9..5cd0d7b8b54 100644 --- a/src/libstd/rt/comm.rs +++ b/src/libstd/rt/comm.rs @@ -125,7 +125,7 @@ impl ChanOne { unsafe { // Install the payload - assert!((*packet).payload.is_none()); + rtassert!((*packet).payload.is_none()); (*packet).payload = Some(val); // Atomically swap out the old state to figure out what @@ -307,7 +307,7 @@ impl SelectInner for PortOne { STATE_ONE => true, // Lost the race. Data available. same_ptr => { // We successfully unblocked our task pointer. - assert!(task_as_state == same_ptr); + rtassert!(task_as_state == same_ptr); let handle = BlockedTask::cast_from_uint(task_as_state); // Because we are already awake, the handle we // gave to this port shall already be empty. @@ -341,7 +341,8 @@ impl SelectPortInner for PortOne { unsafe { // See corresponding store() above in block_on for rationale. // FIXME(#8130) This can happen only in test builds. - assert!((*packet).state.load(Relaxed) == STATE_ONE); + // This load is not required for correctness and may be compiled out. + rtassert!((*packet).state.load(Relaxed) == STATE_ONE); let payload = (*packet).payload.take(); @@ -387,7 +388,7 @@ impl Drop for ChanOne { }, task_as_state => { // The port is blocked waiting for a message we will never send. Wake it. - assert!((*this.packet()).payload.is_none()); + rtassert!((*this.packet()).payload.is_none()); let recvr = BlockedTask::cast_from_uint(task_as_state); do recvr.wake().map_move |woken_task| { Scheduler::run_task(woken_task); diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index a8f3d01351b..111e60ccb2f 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -186,7 +186,7 @@ impl Scheduler { // Should not have any messages let message = stask.sched.get_mut_ref().message_queue.pop(); - assert!(message.is_none()); + rtassert!(message.is_none()); stask.destroyed = true; }