From 7c2abb9d579d13fa61339c24f8c39bc3c27c25db Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Wed, 3 Nov 2021 09:27:36 -0400 Subject: fix: Deno.emit crashes with BorrowMutError (#12627) Warn on await_holding_refcell_ref clippy rule to avoid this in the future. Fixes #12453 --- core/runtime.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/runtime.rs') 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::(); + let n = { + let op_state = op_state.borrow(); + let inner_state = op_state.borrow::(); + 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(()) -- cgit v1.2.3