@@ -151,7 +151,8 @@ impl<'a> Executor<'a> {
151
151
let mut active = self . state ( ) . active . lock ( ) . unwrap ( ) ;
152
152
153
153
// Remove the task from the set of active tasks when the future finishes.
154
- let index = active. vacant_entry ( ) . key ( ) ;
154
+ let entry = active. vacant_entry ( ) ;
155
+ let index = entry. key ( ) ;
155
156
let state = self . state ( ) . clone ( ) ;
156
157
let future = async move {
157
158
let _guard = CallOnDrop ( move || drop ( state. active . lock ( ) . unwrap ( ) . try_remove ( index) ) ) ;
@@ -164,7 +165,7 @@ impl<'a> Executor<'a> {
164
165
. propagate_panic ( true )
165
166
. spawn_unchecked ( |( ) | future, self . schedule ( ) )
166
167
} ;
167
- active . insert ( runnable. waker ( ) ) ;
168
+ entry . insert ( runnable. waker ( ) ) ;
168
169
169
170
runnable. schedule ( ) ;
170
171
task
@@ -398,7 +399,8 @@ impl<'a> LocalExecutor<'a> {
398
399
let mut active = self . inner ( ) . state ( ) . active . lock ( ) . unwrap ( ) ;
399
400
400
401
// Remove the task from the set of active tasks when the future finishes.
401
- let index = active. vacant_entry ( ) . key ( ) ;
402
+ let entry = active. vacant_entry ( ) ;
403
+ let index = entry. key ( ) ;
402
404
let state = self . inner ( ) . state ( ) . clone ( ) ;
403
405
let future = async move {
404
406
let _guard = CallOnDrop ( move || drop ( state. active . lock ( ) . unwrap ( ) . try_remove ( index) ) ) ;
@@ -411,7 +413,7 @@ impl<'a> LocalExecutor<'a> {
411
413
. propagate_panic ( true )
412
414
. spawn_unchecked ( |( ) | future, self . schedule ( ) )
413
415
} ;
414
- active . insert ( runnable. waker ( ) ) ;
416
+ entry . insert ( runnable. waker ( ) ) ;
415
417
416
418
runnable. schedule ( ) ;
417
419
task
0 commit comments