diff --git a/lib/llvm-backend/src/intrinsics.rs b/lib/llvm-backend/src/intrinsics.rs index 52f88cfc6..ccc0acd8e 100644 --- a/lib/llvm-backend/src/intrinsics.rs +++ b/lib/llvm-backend/src/intrinsics.rs @@ -1,7 +1,8 @@ -//! Code for dealing with LLVM and VM intrinsics. +//! Code for dealing with [LLVM][llvm-intrinsics] and VM intrinsics. //! -//! Intrinsics are built-in operations. LLVM intrinsics are used to precisely -//! compute values. VM intrinsics are used to interact with the host VM. +//! VM intrinsics are used to interact with the host VM. +//! +//! [llvm-intrinsics]: https://llvm.org/docs/LangRef.html#intrinsic-functions use inkwell::{ attributes::{Attribute, AttributeLoc}, diff --git a/lib/runtime-core/src/global.rs b/lib/runtime-core/src/global.rs index be9eaf6ae..da7d42a75 100644 --- a/lib/runtime-core/src/global.rs +++ b/lib/runtime-core/src/global.rs @@ -1,5 +1,5 @@ -//! The global module contains the implementation data structures and helper functions used to -//! manipulate and access a wasm globals. +//! The global module contains data structures and helper functions used to +//! manipulate and access Wasm globals. use crate::{ export::Export, import::IsExport, @@ -11,7 +11,7 @@ use std::{ sync::{Arc, Mutex}, }; -/// Container with a descriptor and a reference to a global value. +/// A handle to a Wasm Global pub struct Global { desc: GlobalDescriptor, storage: Arc>, diff --git a/lib/runtime-core/src/lib.rs b/lib/runtime-core/src/lib.rs index f211e80db..ea4ecdfe8 100644 --- a/lib/runtime-core/src/lib.rs +++ b/lib/runtime-core/src/lib.rs @@ -1,15 +1,15 @@ //! Wasmer Runtime Core Library //! -//! The runtime core library provides common data structures which are shared by compiler backends -//! to implement a Web Assembly runtime. +//! This crate provides common data structures which are shared by compiler backends +//! to implement a WebAssembly runtime. //! -//! The runtime core also provides an API for users who use wasmer as an embedded wasm runtime which +//! This crate also provides an API for users who use wasmer as an embedded wasm runtime which //! allows operations like compiling, instantiating, providing imports, access exports, memories, //! and tables for example. //! -//! The runtime core library is recommended to be used by only power users who wish to customize the -//! wasmer runtime. Most wasmer users should prefer the API which is re-exported by the wasmer -//! runtime library which provides common defaults and a friendly API. +//! Most wasmer users should prefer the API which is re-exported by the `wasmer-runtime` +//! library by default. This crate provides additional APIs which may be useful to users +//! that wish to customize the wasmer runtime. //! #![deny( diff --git a/lib/runtime-core/src/loader.rs b/lib/runtime-core/src/loader.rs index 84d2bbbfb..f516643d0 100644 --- a/lib/runtime-core/src/loader.rs +++ b/lib/runtime-core/src/loader.rs @@ -88,7 +88,7 @@ impl Instance for LocalInstance { } } let offset = self.offsets[id]; - let addr: *const u8 = unsafe { self.code.as_ptr().offset(offset as isize) }; + let addr: *const u8 = unsafe { self.code.as_ptr().add(offset) }; use std::mem::transmute; Ok(unsafe { match args_u64.len() { diff --git a/lib/runtime-core/src/typed_func.rs b/lib/runtime-core/src/typed_func.rs index f0c22c31d..d7bf404bc 100644 --- a/lib/runtime-core/src/typed_func.rs +++ b/lib/runtime-core/src/typed_func.rs @@ -658,7 +658,7 @@ macro_rules! impl_traits { Rets: WasmTypeList, { /// Call the typed func and return results. - #[allow(non_snake_case)] + #[allow(non_snake_case, clippy::too_many_arguments)] pub fn call(&self, $( $x: $x, )* ) -> Result { #[allow(unused_parens)] unsafe { diff --git a/lib/wasi/src/macros.rs b/lib/wasi/src/macros.rs index 53986bef4..34112b86b 100644 --- a/lib/wasi/src/macros.rs +++ b/lib/wasi/src/macros.rs @@ -1,3 +1,7 @@ +//! Macros to simplify some common WASI-specific tasks. + +/// Like the `try!` macro or `?` syntax: returns the value if the computation +/// succeeded or returns the error value. macro_rules! wasi_try { ($expr:expr) => {{ let res: Result<_, crate::syscalls::types::__wasi_errno_t> = $expr; @@ -18,6 +22,8 @@ macro_rules! wasi_try { }}; } +/// Reads a string from Wasm memory and returns the invalid argument error +/// code if it fails. macro_rules! get_input_str { ($memory:expr, $data:expr, $len:expr) => {{ wasi_try!($data.get_utf8_string($memory, $len), __WASI_EINVAL)