Stream: git-wasmtime

Topic: wasmtime / PR #4698 cranelift: fix build warning


view this post on Zulip Wasmtime GitHub notifications bot (Aug 11 2022 at 22:55):

abrown opened PR #4698 from fix-warning to main:

In #4375 we introduced a code pattern that appears as a warning when
building the cranelift-interpreter crate:

warning: cannot borrow `*state` as mutable because it is also borrowed as immutable
   --> cranelift/interpreter/src/step.rs:412:13
    |
47  |     let arg = |index: usize| -> Result<V, StepError> {
    |               -------------------------------------- immutable borrow occurs here
48  |         let value_ref = inst_context.args()[index];
49  |         state
    |         ----- first borrow occurs due to use of `*state` in closure
...
412 |             state.set_pinned_reg(arg(0)?);
    |             ^^^^^^^^^^^^^^^^^^^^^---^^^^^
    |             |                    |
    |             |                    immutable borrow later used here
    |             mutable borrow occurs here
    |
    = note: `#[warn(mutable_borrow_reservation_conflict)]` on by default
    = warning: this borrowing pattern was not meant to be accepted, and may become a hard error in the future
    = note: for more information, see issue #59159 <https://github.com/rust-lang/rust/issues/59159>

This change fixes the warning.

<!--

Please ensure that the following steps are all taken care of before submitting
the PR.

Please ensure all communication adheres to the code of conduct.
-->

view this post on Zulip Wasmtime GitHub notifications bot (Aug 11 2022 at 22:58):

jameysharp submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 11 2022 at 22:58):

jameysharp has enabled auto merge for PR #4698.

view this post on Zulip Wasmtime GitHub notifications bot (Aug 11 2022 at 23:52):

jameysharp merged PR #4698.


Last updated: Oct 23 2024 at 20:03 UTC