From 9be493eeaf6e03e2cb9f44ba127c7128c8497e66 Mon Sep 17 00:00:00 2001 From: Andrew Poelstra Date: Wed, 23 Jul 2014 15:19:44 -0700 Subject: [PATCH] Move Local::take() into a scope where it is guaranteed to be used This was causing a mystery crash. Fixed. --- src/macros.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/macros.rs b/src/macros.rs index 00f6aff5..7526d4b0 100644 --- a/src/macros.rs +++ b/src/macros.rs @@ -28,8 +28,6 @@ macro_rules! nu_select( use rustrt::task::Task; use sync::comm::Packet; - let task: Box = 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 = Local::take(); task.deschedule(packets.len(), |task| { match packets[started_count].start_selection(task) { Ok(()) => {