Skip to content

Commit 301f900

Browse files
author
Ron Dahlgren
committed
Assert stk rather than checking null
Given that a big stack is never requested before allocating an initial stack segment, having a non-null stk member here is an invariant.
1 parent 12203a7 commit 301f900

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: src/rt/rust_task.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -587,6 +587,7 @@ rust_task::cleanup_after_turn() {
587587
// stack and false otherwise.
588588
bool
589589
rust_task::new_big_stack() {
590+
assert(stk);
590591
// If we have a cached big stack segment, use it.
591592
if (big_stack) {
592593
// Check to see if we're already on the big stack.
@@ -612,12 +613,11 @@ rust_task::new_big_stack() {
612613
}
613614

614615
big_stack->task = this;
615-
big_stack->next = stk ? stk->next : NULL;
616+
big_stack->next = stk->next;
616617
if (big_stack->next)
617618
big_stack->next->prev = big_stack;
618619
big_stack->prev = stk;
619-
if (stk)
620-
stk->next = big_stack;
620+
stk->next = big_stack;
621621

622622
stk = big_stack;
623623

0 commit comments

Comments
 (0)