From 368a9c70e8fde9daffa8b16fb9372d1a90724c78 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 5 Aug 2016 09:38:41 -0700 Subject: [PATCH] Fix RefCell borrow_mut error on firing timeouts The scope was a little longer than intended! --- src/event_loop.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/event_loop.rs b/src/event_loop.rs index 57b92d135..cf7e1aa10 100644 --- a/src/event_loop.rs +++ b/src/event_loop.rs @@ -237,7 +237,11 @@ impl Loop { } fn consume_timeouts(&mut self, now: Instant) { - while let Some(idx) = self.timer_wheel.borrow_mut().poll(now) { + loop { + let idx = match self.timer_wheel.borrow_mut().poll(now) { + Some(idx) => idx, + None => break, + }; trace!("firing timeout: {}", idx); let handle = self.timeouts.borrow_mut()[idx].1.fire(); if let Some(handle) = handle {