Skip to content

Commit 468d023

Browse files
committed
std: Convert some assert!s to rtassert!
1 parent 30a7a5b commit 468d023

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/libstd/rt/comm.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl<T> ChanOne<T> {
125125
unsafe {
126126

127127
// Install the payload
128-
assert!((*packet).payload.is_none());
128+
rtassert!((*packet).payload.is_none());
129129
(*packet).payload = Some(val);
130130

131131
// Atomically swap out the old state to figure out what
@@ -307,7 +307,7 @@ impl<T> SelectInner for PortOne<T> {
307307
STATE_ONE => true, // Lost the race. Data available.
308308
same_ptr => {
309309
// We successfully unblocked our task pointer.
310-
assert!(task_as_state == same_ptr);
310+
rtassert!(task_as_state == same_ptr);
311311
let handle = BlockedTask::cast_from_uint(task_as_state);
312312
// Because we are already awake, the handle we
313313
// gave to this port shall already be empty.
@@ -341,7 +341,8 @@ impl<T> SelectPortInner<T> for PortOne<T> {
341341
unsafe {
342342
// See corresponding store() above in block_on for rationale.
343343
// FIXME(#8130) This can happen only in test builds.
344-
assert!((*packet).state.load(Relaxed) == STATE_ONE);
344+
// This load is not required for correctness and may be compiled out.
345+
rtassert!((*packet).state.load(Relaxed) == STATE_ONE);
345346

346347
let payload = (*packet).payload.take();
347348

@@ -387,7 +388,7 @@ impl<T> Drop for ChanOne<T> {
387388
},
388389
task_as_state => {
389390
// The port is blocked waiting for a message we will never send. Wake it.
390-
assert!((*this.packet()).payload.is_none());
391+
rtassert!((*this.packet()).payload.is_none());
391392
let recvr = BlockedTask::cast_from_uint(task_as_state);
392393
do recvr.wake().map_move |woken_task| {
393394
Scheduler::run_task(woken_task);

src/libstd/rt/sched.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ impl Scheduler {
186186

187187
// Should not have any messages
188188
let message = stask.sched.get_mut_ref().message_queue.pop();
189-
assert!(message.is_none());
189+
rtassert!(message.is_none());
190190

191191
stask.destroyed = true;
192192
}

0 commit comments

Comments
 (0)