From 6b70c934f17fa320a63ae45b6abe59cde4408d25 Mon Sep 17 00:00:00 2001 From: Jeffrey Charles Date: Wed, 6 Sep 2023 09:59:39 -0400 Subject: [PATCH] Fixes for Rust 1.72 (#465) --- Cargo.toml | 1 + crates/cli/src/wasm_generator/static.rs | 12 +++++++++--- crates/quickjs-wasm-rs/src/js_binding/context.rs | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ddee98bd..686942bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ members = [ "crates/core", "crates/cli", ] +resolver = "2" [workspace.package] version = "1.1.2" diff --git a/crates/cli/src/wasm_generator/static.rs b/crates/cli/src/wasm_generator/static.rs index 84e2143a..dc8c569d 100644 --- a/crates/cli/src/wasm_generator/static.rs +++ b/crates/cli/src/wasm_generator/static.rs @@ -61,9 +61,15 @@ pub fn generate(js: &JS, exports: Vec) -> Result> { let invoke_export = invoke.id(); if !exports.is_empty() { - let ExportItem::Function(realloc_fn) = realloc.item else { unreachable!() }; - let ExportItem::Function(invoke_fn) = invoke.item else { unreachable!() }; - let ExportItem::Memory(memory) = memory.item else { unreachable!() }; + let ExportItem::Function(realloc_fn) = realloc.item else { + unreachable!() + }; + let ExportItem::Function(invoke_fn) = invoke.item else { + unreachable!() + }; + let ExportItem::Memory(memory) = memory.item else { + unreachable!() + }; export_exported_js_functions(&mut module, realloc_fn, invoke_fn, memory, exports); } diff --git a/crates/quickjs-wasm-rs/src/js_binding/context.rs b/crates/quickjs-wasm-rs/src/js_binding/context.rs index 7eeccf3d..48ee7690 100644 --- a/crates/quickjs-wasm-rs/src/js_binding/context.rs +++ b/crates/quickjs-wasm-rs/src/js_binding/context.rs @@ -173,7 +173,7 @@ impl JSContextRef { JS_WRITE_OBJ_BYTECODE as i32, ); Ok(Vec::from_raw_parts( - output_buffer as *mut u8, + output_buffer, output_size.try_into()?, output_size.try_into()?, ))