diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2021-11-03 09:27:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-03 09:27:36 -0400 |
commit | 7c2abb9d579d13fa61339c24f8c39bc3c27c25db (patch) | |
tree | c3ce3cefff867dd3f073eda18ebed53f728e4675 /core/runtime.rs | |
parent | 95b2955712b0daae3c8e8f7bb0eccf341b5c8fa3 (diff) |
fix: Deno.emit crashes with BorrowMutError (#12627)
Warn on await_holding_refcell_ref clippy rule to avoid this in the future.
Fixes #12453
Diffstat (limited to 'core/runtime.rs')
-rw-r--r-- | core/runtime.rs | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/core/runtime.rs b/core/runtime.rs index 80221295d..704be7a76 100644 --- a/core/runtime.rs +++ b/core/runtime.rs @@ -2317,11 +2317,14 @@ assertEquals(1, notify_return_value); _: (), _: (), ) -> Result<(), AnyError> { - let op_state = op_state.borrow(); - let inner_state = op_state.borrow::<InnerState>(); + let n = { + let op_state = op_state.borrow(); + let inner_state = op_state.borrow::<InnerState>(); + inner_state.0 + }; // Future must be Poll::Pending on first call tokio::time::sleep(std::time::Duration::from_millis(1)).await; - if inner_state.0 != 42 { + if n != 42 { unreachable!(); } Ok(()) |