Skip to content

Commit 825f1d7

Browse files
committed
Fix a compiler warning.
Fix the following warning from Rust 1.35: warning: cannot borrow `*self` as mutable because it is also borrowed as immutable --> wasmtime-runtime/src/instance.rs:473:25 | 465 | } else if let Some(start_export) = self.module.exports.get("_start") { | ----------- immutable borrow occurs here ... 473 | self.invoke_function(*func_index) | ^^^^ ----------- 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 <rust-lang/rust#59159>
1 parent b5f4949 commit 825f1d7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

wasmtime-runtime/src/instance.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -466,11 +466,11 @@ impl Instance {
466466
// As a compatibility measure, if the module doesn't have a start
467467
// function but does have a _start function exported, call that.
468468
match start_export {
469-
wasmtime_environ::Export::Function(func_index) => {
470-
let sig = &self.module.signatures[self.module.functions[*func_index]];
469+
&wasmtime_environ::Export::Function(func_index) => {
470+
let sig = &self.module.signatures[self.module.functions[func_index]];
471471
// No wasm params or returns; just the vmctx param.
472472
if sig.params.len() == 1 && sig.returns.is_empty() {
473-
self.invoke_function(*func_index)
473+
self.invoke_function(func_index)
474474
} else {
475475
Ok(())
476476
}
@@ -482,11 +482,11 @@ impl Instance {
482482
// start function or a _start function exported, but does have a main
483483
// function exported, call that.
484484
match main_export {
485-
wasmtime_environ::Export::Function(func_index) => {
486-
let sig = &self.module.signatures[self.module.functions[*func_index]];
485+
&wasmtime_environ::Export::Function(func_index) => {
486+
let sig = &self.module.signatures[self.module.functions[func_index]];
487487
// No wasm params or returns; just the vmctx param.
488488
if sig.params.len() == 1 && sig.returns.is_empty() {
489-
self.invoke_function(*func_index)
489+
self.invoke_function(func_index)
490490
} else {
491491
Ok(())
492492
}

0 commit comments

Comments
 (0)