diff --git a/ext/src/ruby_api/global.rs b/ext/src/ruby_api/global.rs index d5c394e6..bfd6c0ef 100644 --- a/ext/src/ruby_api/global.rs +++ b/ext/src/ruby_api/global.rs @@ -55,7 +55,7 @@ impl<'a> Global<'a> { mutability: Mutability, ) -> Result { let wasm_type = value_type.to_val_type()?; - let wasm_default = default.to_wasm_val(wasm_type)?; + let wasm_default = default.to_wasm_val(wasm_type.clone())?; let inner = GlobalImpl::new( s.context_mut(), GlobalType::new(wasm_type, mutability), @@ -95,7 +95,7 @@ impl<'a> Global<'a> { /// @def type /// @return [Symbol] The Wasm type of the global‘s content. pub fn type_(&self) -> Result { - self.ty().map(|ty| (*ty.content()).to_sym()) + self.ty().map(|ty| (ty.content()).clone().to_sym()) } /// @yard @@ -129,7 +129,7 @@ impl<'a> Global<'a> { } fn value_type(&self) -> Result { - self.ty().map(|ty| *ty.content()) + self.ty().map(|ty| ty.content().clone()) } fn retain_non_nil_extern_ref(&self, value: Value) -> Result<(), Error> { diff --git a/ext/src/ruby_api/params.rs b/ext/src/ruby_api/params.rs index 6c617873..6cc9d46c 100644 --- a/ext/src/ruby_api/params.rs +++ b/ext/src/ruby_api/params.rs @@ -21,7 +21,7 @@ impl Param { fn to_wasmtime_val(&self) -> Result { self.val - .to_wasm_val(self.ty) + .to_wasm_val(self.ty.clone()) .map_err(|error| match error.error_type() { ErrorType::Error(class, msg) => { Error::new(*class, format!("{} (param at index {})", msg, self.index)) diff --git a/ext/src/ruby_api/table.rs b/ext/src/ruby_api/table.rs index 146af627..cd1ac001 100644 --- a/ext/src/ruby_api/table.rs +++ b/ext/src/ruby_api/table.rs @@ -51,7 +51,7 @@ impl<'a> Table<'a> { let (min,) = kw.required; let (max,) = kw.optional; let wasm_type = value_type.to_val_type()?; - let wasm_default = default.to_wasm_val(wasm_type)?; + let wasm_default = default.to_wasm_val(wasm_type.clone())?; let inner = TableImpl::new( s.context_mut(), diff --git a/ext/src/ruby_api/wasi_ctx_builder.rs b/ext/src/ruby_api/wasi_ctx_builder.rs index 568bf1e0..8dcc53d9 100644 --- a/ext/src/ruby_api/wasi_ctx_builder.rs +++ b/ext/src/ruby_api/wasi_ctx_builder.rs @@ -213,14 +213,18 @@ impl WasiCtxBuilder { if let Some(stdout) = inner.stdout.as_ref() { match stdout { WriteStream::Inherit => builder.inherit_stdout(), - WriteStream::Path(path) => builder.stdout(file_w(*path).map(wasi_file)?), + WriteStream::Path(path) => { + builder.stdout(file_w(ruby.get_inner(*path)).map(wasi_file)?) + } }; } if let Some(stderr) = inner.stderr.as_ref() { match stderr { WriteStream::Inherit => builder.inherit_stderr(), - WriteStream::Path(path) => builder.stderr(file_w(*path).map(wasi_file)?), + WriteStream::Path(path) => { + builder.stderr(file_w(ruby.get_inner(*path)).map(wasi_file)?) + } }; } @@ -235,7 +239,7 @@ impl WasiCtxBuilder { } if let Some(env_hash) = inner.env.as_ref() { - let env_vec: Vec<(String, String)> = env_hash.to_vec()?; + let env_vec: Vec<(String, String)> = ruby.get_inner(*env_hash).to_vec()?; builder.envs(&env_vec).map_err(|e| error!("{}", e))?; }