Move Local::take() into a scope where it is guaranteed to be used

This was causing a mystery crash. Fixed.
This commit is contained in:
Andrew Poelstra 2014-07-23 15:19:44 -07:00
parent 1be45395da
commit 9be493eeaf
1 changed files with 2 additions and 2 deletions

View File

@ -28,8 +28,6 @@ macro_rules! nu_select(
use rustrt::task::Task;
use sync::comm::Packet;
let task: Box<Task> = Local::take();
// Is anything already ready to receive? Grab it without waiting.
$(
if (&$rx as &Packet).can_recv() {
@ -44,6 +42,8 @@ macro_rules! nu_select(
// that we started.
let mut started_count = 0;
let packets = [ $( &$rx as &Packet, )+ ];
let task: Box<Task> = Local::take();
task.deschedule(packets.len(), |task| {
match packets[started_count].start_selection(task) {
Ok(()) => {