Skip to content

A lightweight WebAssembly runtime that is fast, secure, and standards-compliant

Forbid rustdoc warnings in CI (#12420)

Alex Crichtonbc4582c347aa
diff --git a/.github/actions/install-rust/action.yml b/.github/actions/install-rust/action.yml
index 4d3d7cddfc..7252fb3b73 100644
--- a/.github/actions/install-rust/action.yml
+++ b/.github/actions/install-rust/action.yml
@@ -32,7 +32,7 @@ runs:
elif [ "${{ inputs.toolchain }}" = "msrv" ]; then
echo "version=1.$msrv.0" >> "$GITHUB_OUTPUT"
elif [ "${{ inputs.toolchain }}" = "wasmtime-ci-pinned-nightly" ]; then
- echo "version=nightly-2026-01-22" >> "$GITHUB_OUTPUT"
+ echo "version=nightly-2026-01-26" >> "$GITHUB_OUTPUT"
else
echo "version=${{ inputs.toolchain }}" >> "$GITHUB_OUTPUT"
fi
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 0ba6fe064a..dbcab19889 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -261,7 +261,7 @@ jobs:
env:
MDBOOK_VERSION: 0.4.37
MDBOOK_LANGTABS_VERSION: 0.1.1
- RUSTDOCFLAGS: -Dbroken_intra_doc_links --cfg docsrs
+ RUSTDOCFLAGS: -Dwarnings --cfg docsrs
OPENVINO_SKIP_LINKING: 1
steps:
- uses: actions/checkout@v4
@@ -304,11 +304,7 @@ jobs:
--exclude wasm-spec-interpreter \
--exclude calculator \
--all-features
- env:
- RUSTDOCFLAGS: --cfg=docsrs
- run: cargo doc --package cranelift-codegen-meta --document-private-items
- env:
- RUSTDOCFLAGS: --cfg=docsrs
# Assemble the documentation, and always upload it as an artifact for
# inspection on PRs and such.
diff --git a/cranelift/assembler-x64/meta/src/dsl/custom.rs b/cranelift/assembler-x64/meta/src/dsl/custom.rs
index 93801d620b..1efc95314d 100644
--- a/cranelift/assembler-x64/meta/src/dsl/custom.rs
+++ b/cranelift/assembler-x64/meta/src/dsl/custom.rs
@@ -16,7 +16,7 @@ pub enum Customization {
/// Modify how an instruction is emitted into the code buffer.
Encode,
/// Modify the instruction mnemonic (see [`crate::dsl::Inst::mnemonic`]);
- /// this customization is irrelevant if [`CustomOperation::Display`] is also
+ /// this customization is irrelevant if [`Customization::Display`] is also
/// specified.
Mnemonic,
/// Modify how a register allocator visits the operands of an instruction.
diff --git a/cranelift/assembler-x64/meta/src/dsl/encoding.rs b/cranelift/assembler-x64/meta/src/dsl/encoding.rs
index e54608f1ea..c843e609d7 100644
--- a/cranelift/assembler-x64/meta/src/dsl/encoding.rs
+++ b/cranelift/assembler-x64/meta/src/dsl/encoding.rs
@@ -184,9 +184,9 @@ pub struct Rex {
/// instruction lists the corresponding hexadecimal value of the opcode byte
/// with low 3 bits as 000b. In non-64-bit mode, a register code, from 0
/// through 7, is added to the hexadecimal value of the opcode byte. In
- /// 64-bit mode, indicates the four bit field of REX.b and opcode[2:0] field
- /// encodes the register operand of the instruction. “+ro” is applicable
- /// only in 64-bit mode."
+ /// 64-bit mode, indicates the four bit field of REX.b and `opcode[2:0]`
+ /// field encodes the register operand of the instruction. “+ro” is
+ /// applicable only in 64-bit mode."
pub opcode_mod: Option<OpcodeMod>,
}
@@ -1173,9 +1173,9 @@ impl Vex {
}
/// An 8-bit immediate byte is present containing a source register
- /// specifier in either imm8[7:4] (for 64-bit
- /// mode) or imm8[6:4] (for 32-bit mode), and instruction-specific payload
- /// in imm8[3:0].
+ /// specifier in either `imm8[7:4]` (for 64-bit
+ /// mode) or `imm8[6:4]` (for 32-bit mode), and instruction-specific payload
+ /// in `imm8[3:0]`.
pub fn is4(self) -> Self {
Self { is4: true, ..self }
}
diff --git a/cranelift/assembler-x64/meta/src/dsl/format.rs b/cranelift/assembler-x64/meta/src/dsl/format.rs
index cb6b8e5a96..3167bb1e41 100644
--- a/cranelift/assembler-x64/meta/src/dsl/format.rs
+++ b/cranelift/assembler-x64/meta/src/dsl/format.rs
@@ -591,7 +591,7 @@ impl core::fmt::Display for Extension {
/// In the future, we might want to model specific EFLAGS bits instead of the
/// entire EFLAGS register.
/// Some related discussion in this GitHub issue
-/// https://github.com/bytecodealliance/wasmtime/issues/10298
+/// <https://github.com/bytecodealliance/wasmtime/issues/10298>
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum Eflags {
None,
diff --git a/cranelift/assembler-x64/src/mem.rs b/cranelift/assembler-x64/src/mem.rs
index 8235f9b5bf..e104f9dfd1 100644
--- a/cranelift/assembler-x64/src/mem.rs
+++ b/cranelift/assembler-x64/src/mem.rs
@@ -128,7 +128,7 @@ impl core::fmt::LowerHex for AmodeOffset {
/// Cranelift, this structure stores an optional [`KnownOffset`]. The following
/// happens immediately before emission:
/// - the [`KnownOffset`] is looked up, mapping it to an offset value
-/// - the [`Simm32`] value is added to the offset value
+/// - the [`AmodeOffset`] value is added to the offset value
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct AmodeOffsetPlusKnownOffset {
pub simm32: AmodeOffset,
diff --git a/cranelift/codegen/src/ir/debug_tags.rs b/cranelift/codegen/src/ir/debug_tags.rs
index 39d137c297..970635d2ca 100644
--- a/cranelift/codegen/src/ir/debug_tags.rs
+++ b/cranelift/codegen/src/ir/debug_tags.rs
@@ -73,7 +73,7 @@ impl DebugTags {
/// Set the tags on an instruction, overwriting existing tag list.
///
/// Tags can only be set on call instructions (those for which
- /// [`crate::Opcode::is_call()`] returns `true`) and on
+ /// [`crate::ir::Opcode::is_call()`] returns `true`) and on
/// `sequence_point` instructions. This property is checked by the
/// CLIF verifier.
pub fn set(&mut self, inst: Inst, tags: impl IntoIterator<Item = DebugTag>) {
diff --git a/cranelift/codegen/src/ir/entities.rs b/cranelift/codegen/src/ir/entities.rs
index cbb8f3097a..d0ee82ca48 100644
--- a/cranelift/codegen/src/ir/entities.rs
+++ b/cranelift/codegen/src/ir/entities.rs
@@ -57,7 +57,6 @@ impl Block {
/// - [`f64const`](super::InstBuilder::f64const) for 64-bit float constants
/// - [`f128const`](super::InstBuilder::f128const) for 128-bit float constants
/// - [`vconst`](super::InstBuilder::vconst) for vector constants
-/// - [`null`](super::InstBuilder::null) for null reference constants
///
/// Any `InstBuilder` instruction that has an output will also return a `Value`.
///
diff --git a/cranelift/codegen/src/ir/exception_table.rs b/cranelift/codegen/src/ir/exception_table.rs
index 4130f23792..3ff7bb6636 100644
--- a/cranelift/codegen/src/ir/exception_table.rs
+++ b/cranelift/codegen/src/ir/exception_table.rs
@@ -129,7 +129,7 @@ impl ExceptionTableData {
/// `BlockArg::TryCallExn` in the exceptional-return cases, with
/// types corresponding to native machine words and an arity
/// corresponding to the number of payload values that the calling
- /// convention and platform support. (See [`isa::CallConv`] for
+ /// convention and platform support. (See [`CallConv`](crate::isa::CallConv) for
/// more details.)
pub fn new(
sig: SigRef,
diff --git a/cranelift/codegen/src/lib.rs b/cranelift/codegen/src/lib.rs
index 1cfb95c1f2..cbf47a02fa 100644
--- a/cranelift/codegen/src/lib.rs
+++ b/cranelift/codegen/src/lib.rs
@@ -74,10 +74,10 @@ pub use crate::machinst::buffer::{
OpenPatchRegion, PatchRegion,
};
pub use crate::machinst::{
- CallInfo, CompiledCode, Final, MachBuffer, MachBufferDebugTagList, MachBufferFinalized,
- MachBufferFrameLayout, MachDebugTagPos, MachInst, MachInstEmit, MachInstEmitState, MachLabel,
- RealReg, Reg, RelocDistance, TextSectionBuilder, VCodeConstant, VCodeConstantData,
- VCodeConstants, VCodeInst, Writable,
+ CallInfo, CompiledCode, Final, FrameLayout, MachBuffer, MachBufferDebugTagList,
+ MachBufferFinalized, MachBufferFrameLayout, MachDebugTagPos, MachInst, MachInstEmit,
+ MachInstEmitState, MachLabel, RealReg, Reg, RelocDistance, TextSectionBuilder, VCodeConstant,
+ VCodeConstantData, VCodeConstants, VCodeInst, Writable,
};
mod alias_analysis;
diff --git a/cranelift/isle/veri/veri_engine/src/solver.rs b/cranelift/isle/veri/veri_engine/src/solver.rs
index 38ac6d463b..c663400077 100644
--- a/cranelift/isle/veri/veri_engine/src/solver.rs
+++ b/cranelift/isle/veri/veri_engine/src/solver.rs
@@ -1615,8 +1615,11 @@ impl SolverCtx {
}
/// Overall query for single rule:
+///
+/// ```text
/// <declare vars>
/// (not (=> <assumptions> (= <LHS> <RHS>))))))
+/// ```
pub fn run_solver(
rule_sem: &RuleSemantics,
rule: &Rule,
diff --git a/cranelift/isle/veri/veri_ir/src/annotation_ir.rs b/cranelift/isle/veri/veri_ir/src/annotation_ir.rs
index 44e0652efa..e3b29cb223 100644
--- a/cranelift/isle/veri/veri_ir/src/annotation_ir.rs
+++ b/cranelift/isle/veri/veri_ir/src/annotation_ir.rs
@@ -79,7 +79,7 @@ pub enum Type {
Poly(u32),
/// The expression is a bitvector, currently modeled in the
- /// logic QF_BV https://SMT-LIB.cs.uiowa.edu/version1/logics/QF_BV.smt
+ /// logic QF_BV <https://SMT-LIB.cs.uiowa.edu/version1/logics/QF_BV.smt>
/// This corresponds to Cranelift's Isle type:
/// (type Value (primitive Value))
BitVector,
diff --git a/cranelift/isle/veri/veri_ir/src/lib.rs b/cranelift/isle/veri/veri_ir/src/lib.rs
index aa48053e07..73e3663616 100644
--- a/cranelift/isle/veri/veri_ir/src/lib.rs
+++ b/cranelift/isle/veri/veri_ir/src/lib.rs
@@ -42,7 +42,7 @@ pub struct BoundVar {
#[derive(Clone, Debug, PartialEq, Eq, Hash, Copy)]
pub enum Type {
/// The expression is a bitvector, currently modeled in the
- /// logic QF_BV https://SMT-LIB.cs.uiowa.edu/version1/logics/QF_BV.smt
+ /// logic QF_BV <https://SMT-LIB.cs.uiowa.edu/version1/logics/QF_BV.smt>
/// This corresponds to Cranelift's Isle type:
/// (type Value (primitive Value))
BitVector(Option<usize>),
diff --git a/crates/core/src/alloc/try_new.rs b/crates/core/src/alloc/try_new.rs
index 1e1a6f0106..72f52975d1 100644
--- a/crates/core/src/alloc/try_new.rs
+++ b/crates/core/src/alloc/try_new.rs
@@ -22,7 +22,7 @@ where
}
/// Extension trait providing fallible allocation for types like `Arc<T>` and
-/// `Box<T>.
+/// `Box<T>`.
pub trait TryNew {
/// The inner `T` type that is getting wrapped into an `Arc<T>` or `Box<T>`.
type Value;
diff --git a/crates/core/src/error/context.rs b/crates/core/src/error/context.rs
index 7357cb9cc8..f20b997eba 100644
--- a/crates/core/src/error/context.rs
+++ b/crates/core/src/error/context.rs
@@ -20,17 +20,16 @@ mod sealed {
/// This extension trait, and its methods, are the primary way to create error
/// chains. An error's debug output will include the full chain of
/// errors. Errors in these chains are accessible via the
-/// [`Error::chain`][crate::Error::chain] and
-/// [`Error::root_cause`][crate::Error::root_cause] methods.
+/// [`Error::chain`] and [`Error::root_cause`] methods.
///
/// After applying error context of type `C`, calling
-/// [`error.is::<C>()`][crate::Error::is] will return `true` for the new error
+/// [`error.is::<C>()`](Error::is) will return `true` for the new error
/// (unless there was a memory allocation failure) in addition to any other
/// types `T` for which it was already the case that `error.is::<T>()`.
///
/// This boxes the inner `C` type, but if that box allocation fails, then this
/// trait's functions return an `Error` where
-/// [`error.is::<OutOfMemory>()`][crate::OutOfMemory] is true.
+/// [`error.is::<OutOfMemory>()`](OutOfMemory) is true.
///
/// # Example
///
@@ -112,7 +111,7 @@ pub trait Context<T, E>: sealed::Sealed {
/// it should only be used when the `context` is already available or is
/// effectively a constant. Otherwise, it effectively forces computation of
/// the context, even when we aren't on an error path. The
- /// [`Context::with_context`][crate::Context::with_context] method is
+ /// [`Context::with_context`](Context::with_context) method is
/// preferred in these scenarios, as it lazily computes the error context,
/// only doing so when we are actually on an error path.
fn context<C>(self, context: C) -> Result<T, Error>
diff --git a/crates/core/src/error/error.rs b/crates/core/src/error/error.rs
index 29f03639bd..8bede3f8f9 100644
--- a/crates/core/src/error/error.rs
+++ b/crates/core/src/error/error.rs
@@ -235,9 +235,9 @@ impl BoxedDynError {
/// it will automatically get constructed from the root cause error for you.
///
/// Most often when creating an `Error`, you just want to early-exit from the
-/// function, returning `Err(...)`. The [`ensure!`][crate::ensure] macro
+/// function, returning `Err(...)`. The [`ensure!`](crate::ensure) macro
/// early-returns an error when a condition is not met (similar to how `assert!`
-/// panics when a condition is not met) and the [`bail!`][crate::bail] macro
+/// panics when a condition is not met) and the [`bail!`](crate::bail) macro
/// early-returns an error unconditionally.
///
/// ```
@@ -260,7 +260,7 @@ impl BoxedDynError {
/// ```
///
/// If you do not want to early-return, just to create the `Error`, then the
-/// [`format_err!`][crate::format_err] macro is preferred:
+/// [`format_err!`](crate::format_err) macro is preferred:
///
/// ```
/// # use wasmtime_internal_core::error as wasmtime;
@@ -517,7 +517,7 @@ impl From<Error> for Box<dyn core::error::Error + 'static> {
}
}
-/// Convert a [`wasmtime::Error`][crate::Error] into an [`anyhow::Error`].
+/// Convert a [`wasmtime::Error`](Error) into an [`anyhow::Error`].
///
/// # Example
///
@@ -572,12 +572,12 @@ impl Error {
/// Construct a new `Error` from a type that implements
/// `core::error::Error`.
///
- /// Calling [`error.is::<E>()`][Error::is] will return `true` for the new
+ /// Calling [`error.is::<E>()`](Error::is) will return `true` for the new
/// error (unless there was a memory allocation failure).
///
/// This boxes the inner error, but if that box allocation fails, then this
/// function returns an `Error` where
- /// [`error.is::<OutOfMemory>()`][crate::OutOfMemory] is true.
+ /// [`error.is::<OutOfMemory>()`](OutOfMemory) is true.
///
/// # Example
///
@@ -611,12 +611,12 @@ impl Error {
/// Construct a new `Error` from any type that implements `Debug` and
/// `Display`.
///
- /// Calling [`error.is::<M>()`][Error::is] will return `true` for the new
+ /// Calling [`error.is::<M>()`](Error::is) will return `true` for the new
/// error (unless there was a memory allocation failure).
///
/// This boxes the inner `M` type, but if that box allocation fails, then
/// this function returns an `Error` where
- /// [`error.is::<OutOfMemory>()`][crate::OutOfMemory] is true.
+ /// [`error.is::<OutOfMemory>()`](OutOfMemory) is true.
///
/// # Example
///
@@ -641,12 +641,12 @@ impl Error {
/// `error.is::<anyhow::Error>()`.
///
/// Calling [`error.is::<Box<dyn core::error::Error + Send + Sync +
- /// 'static>>()`][Error::is] will return `true` for the new error (unless
+ /// 'static>>()`](Error::is) will return `true` for the new error (unless
/// there was a memory allocation failure).
///
/// This reboxes the inner error, but if that box allocation fails, then
/// this function returns an `Error` where
- /// [`error.is::<OutOfMemory>()`][crate::OutOfMemory] is true.
+ /// [`error.is::<OutOfMemory>()`](OutOfMemory) is true.
///
/// # Example
///
@@ -670,12 +670,12 @@ impl Error {
/// Convert an `anyhow::Error` into an `Error`.
///
- /// Calling [`error.is::<anyhow::Error>()`][Error::is] will return `true`
+ /// Calling [`error.is::<anyhow::Error>()`](Error::is) will return `true`
/// for the new error (unless there was a memory allocation failure).
///
/// This reboxes the `anyhow::Error`, but if that box allocation fails, then
/// this function returns an `Error` where
- /// [`error.is::<OutOfMemory>()`][crate::OutOfMemory] is true.
+ /// [`error.is::<OutOfMemory>()`](OutOfMemory) is true.
///
/// # Example
///
@@ -706,14 +706,16 @@ impl Error {
/// is a method directly on [`Error`], there is no need for lazily-computing
/// the error context (like `with_context` does).
///
- /// Calling [`error.is::<C>()`][Error::is] will return `true` for the new
+ /// Calling [`error.is::<C>()`](Error::is) will return `true` for the new
/// error (unless there was a memory allocation failure) in addition to any
/// other types `T` for which it was already the case that
/// `error.is::<T>()`.
///
/// This boxes the inner `C` type, but if that box allocation fails, then
/// this function returns an `Error` where
- /// [`error.is::<OutOfMemory>()`][crate::OutOfMemory] is true.
+ /// [`error.is::<OutOfMemory>()`](OutOfMemory) is true.
+ ///
+ /// [`Context::context`]: crate::error::Context::context
///
/// # Example
///
diff --git a/crates/core/src/error/macros.rs b/crates/core/src/error/macros.rs
index 227d2fb52b..3e85c07e05 100644
--- a/crates/core/src/error/macros.rs
+++ b/crates/core/src/error/macros.rs
@@ -9,10 +9,10 @@ use super::{Error, OutOfMemory};
use core::fmt::{self, write};
use std_alloc::string::String;
-/// Construct an [`Error`](crate::Error) via string formatting or another error.
+/// Construct an [`Error`] via string formatting or another error.
///
/// Like `anyhow::format_err!` or `anyhow::anyhow!` but for
-/// [`wasmtime::Error`][crate::Error].
+/// [`wasmtime::Error`](Error).
///
/// # String Formatting
///
@@ -37,9 +37,9 @@ use std_alloc::string::String;
/// # From Another Error
///
/// When a string literal is not the first argument, then it is treated as a
-/// foreign error and is converted into an [`Error`][crate::Error]. The argument
-/// must be of a type that can be passed to either
-/// [`Error::new`][crate::Error::new] or [`Error::msg`][crate::Error::msg]:
+/// foreign error and is converted into an [`Error`]. The argument
+/// must be of a type that can be passed to either [`Error::new`] or
+/// [`Error::msg`].
///
/// ```
/// # fn _foo() {
@@ -70,7 +70,7 @@ use std_alloc::string::String;
/// The `format_err!` macro can always convert an `anyhow::Error` into a
/// `wasmtime::Error`, but when the `"anyhow"` cargo feature is enabled the
/// resulting error will also return true for
-/// [`error.is::<anyhow::Error>()`][crate::Error::is] invocations.
+/// [`error.is::<anyhow::Error>()`](Error::is) invocations.
///
/// ```
/// # fn _foo() {
@@ -104,7 +104,7 @@ macro_rules! format_err {
}};
}
-/// Identical to the [`format_err!`][crate::format_err] macro.
+/// Identical to the [`format_err!`] macro.
///
/// This is provided for API compatibility with the `anyhow` crate, but you
/// should prefer using `format_err!` instead.
@@ -120,10 +120,10 @@ macro_rules! anyhow {
///
/// This helper is equivalent to `return Err(format_err!(...))`.
///
-/// See the docs for the [`format_err!`][crate::format_err] macro for details on
+/// See the docs for the [`format_err!`] macro for details on
/// the kinds of errors that can be constructed.
///
-/// Like `anyhow::bail!` but for [`wasmtime::Error`][crate::Error].
+/// Like `anyhow::bail!` but for [`wasmtime::Error`](Error).
///
/// # Example
///
@@ -165,7 +165,7 @@ macro_rules! bail {
/// }
/// ```
///
-/// Like `anyhow::ensure!` but for [`wasmtime::Error`][crate::Error].
+/// Like `anyhow::ensure!` but for [`wasmtime::Error`](Error).
///
/// # Example
///
diff --git a/crates/core/src/error/oom.rs b/crates/core/src/error/oom.rs
index aeac66b4c5..23e0aaaada 100644
--- a/crates/core/src/error/oom.rs
+++ b/crates/core/src/error/oom.rs
@@ -5,12 +5,11 @@ use core::{fmt, mem, ptr::NonNull};
///
/// This error is the sentinel for allocation failure due to memory exhaustion.
///
-/// Constructing an [`Error`][crate::Error] from an `OutOfMemory` does not
+/// Constructing an [`Error`] from an `OutOfMemory` does not
/// allocate.
///
/// Allocation failure inside any `Error` method that must allocate
-/// (e.g. [`Error::context`][crate::Error::context]) will propagate an
-/// `OutOfMemory` error.
+/// (e.g. [`Error::context`]) will propagate an `OutOfMemory` error.
#[derive(Clone, Copy)]
// NB: `OutOfMemory`'s representation must be the same as `OomOrDynError`
// (and therefore also `Error`).
diff --git a/crates/environ/src/frame_table.rs b/crates/environ/src/frame_table.rs
index 3fe0bfa8ed..e1ae0d72bb 100644
--- a/crates/environ/src/frame_table.rs
+++ b/crates/environ/src/frame_table.rs
@@ -2,7 +2,7 @@
//!
//! This module contains utilities to interpret the `.wasmtime.frame`
//! section in a compiled artifact as produced by
-//! [`crate::compile::frame_table::FrameTableBuilder`].
+//! [`crate::compile::FrameTableBuilder`].
use crate::FuncKey;
use alloc::vec::Vec;
@@ -63,7 +63,7 @@ pub struct FrameTable<'a> {
impl<'a> FrameTable<'a> {
/// Parse a frame table section from a byte-slice as produced by
- /// [`crate::compile::frame_table::FrameTableBuilder`].
+ /// [`crate::compile::FrameTableBuilder`].
pub fn parse(data: &'a [u8], original_text: &'a [u8]) -> anyhow::Result<FrameTable<'a>> {
let mut data = Bytes(data);
let num_frame_descriptors = data
diff --git a/crates/environ/src/obj.rs b/crates/environ/src/obj.rs
index 9a3eb6e06a..505ec2931c 100644
--- a/crates/environ/src/obj.rs
+++ b/crates/environ/src/obj.rs
@@ -104,9 +104,8 @@ pub const ELF_WASMTIME_TRAPS: &str = ".wasmtime.traps";
/// This section is used at runtime to allow the unwinder to find
/// exception handler blocks active at particular callsites.
///
-/// This section's format is defined by the
-/// [`wasmtime_unwinder::ExceptionTableBuilder`] data structure. Its
-/// code offsets are relative to the start of the text segment.
+/// This section's format is defined by the `ExceptionTableBuilder` data
+/// structure. Its code offsets are relative to the start of the text segment.
pub const ELF_WASMTIME_EXCEPTIONS: &str = ".wasmtime.exceptions";
/// A custom binary-encoded section of the wasmtime compilation
@@ -116,7 +115,7 @@ pub const ELF_WASMTIME_EXCEPTIONS: &str = ".wasmtime.exceptions";
/// VM-level state from state stack slots.
///
/// This section's format is defined by the
-/// [`wasmtime_environ::FrameTableBuilder`] data structure. Its code
+/// [`crate::compile::FrameTableBuilder`] data structure. Its code
/// offsets are relative to the start of the text segment.
pub const ELF_WASMTIME_FRAMES: &str = ".wasmtime.frames";
diff --git a/crates/wasi-http/src/handler.rs b/crates/wasi-http/src/handler.rs
index ccffdec27e..c8496710d1 100644
--- a/crates/wasi-http/src/handler.rs
+++ b/crates/wasi-http/src/handler.rs
@@ -144,7 +144,7 @@ pub struct StoreBundle<T: 'static> {
/// Represents the application-specific state of a web server.
pub trait HandlerState: 'static + Sync + Send {
/// The type of the associated data for [`Store`]s created using
- /// [`new_store`].
+ /// [`Self::new_store`].
type StoreData: Send;
/// Create a new [`Store`] for handling one or more requests.
@@ -530,7 +530,7 @@ where
///
/// Note that this supports optional instance reuse, enabled when
/// `S::max_instance_reuse_count()` returns a number greater than one. See
-/// [`Self::push`] for details.
+/// [`Self::spawn`] for details.
pub struct ProxyHandler<S: HandlerState>(Arc<ProxyHandlerInner<S>>);
impl<S: HandlerState> Clone for ProxyHandler<S> {
diff --git a/crates/wasi-http/src/lib.rs b/crates/wasi-http/src/lib.rs
index 2b52f8317c..358682ddc9 100644
--- a/crates/wasi-http/src/lib.rs
+++ b/crates/wasi-http/src/lib.rs
@@ -19,7 +19,7 @@
//! [`wasi:http/types`]: crate::bindings::http::types::Host
//! [`wasi:http/incoming-handler`]: crate::bindings::exports::wasi::http::incoming_handler::Guest
//!
-//! This crate is very similar to [`wasmtime-wasi`] in the it uses the
+//! This crate is very similar to [`wasmtime_wasi`] in the it uses the
//! `bindgen!` macro in Wasmtime to generate bindings to interfaces. Bindings
//! are located in the [`bindings`] module.
//!
diff --git a/crates/wasi/src/cli.rs b/crates/wasi/src/cli.rs
index 97db6acb11..090a656c4c 100644
--- a/crates/wasi/src/cli.rs
+++ b/crates/wasi/src/cli.rs
@@ -30,6 +30,8 @@ pub use tokio::io::{Stderr, Stdin, Stdout, stderr, stdin, stdout};
/// When using this type you can skip the [`WasiCliView`] trait, for
/// example.
///
+/// [`wasmtime_wasi::p2::bindings::cli::environment::add_to_linker`]: crate::p2::bindings::cli::environment::add_to_linker
+///
/// # Examples
///
/// ```
diff --git a/crates/wasi/src/cli/file.rs b/crates/wasi/src/cli/file.rs
index 80e6d94552..9506a70ba2 100644
--- a/crates/wasi/src/cli/file.rs
+++ b/crates/wasi/src/cli/file.rs
@@ -8,8 +8,10 @@ use std::task::{Context, Poll};
use tokio::io::{self, AsyncRead, AsyncWrite};
/// This implementation will yield output streams that block on writes, and
-/// output directly to a file. If truly async output is required, [`AsyncStdoutStream`]
-/// should be used instead.
+/// output directly to a file. If truly async output is required,
+/// [`AsyncStdoutStream`] should be used instead.
+///
+/// [`AsyncStdoutStream`]: crate::cli::AsyncStdoutStream
#[derive(Clone)]
pub struct OutputFile {
file: Arc<std::fs::File>,
@@ -85,6 +87,8 @@ impl AsyncWrite for OutputFile {
/// This implementation will yield input streams that block on reads, and
/// reads directly from a file. If truly async input is required,
/// [`AsyncStdinStream`] should be used instead.
+///
+/// [`AsyncStdinStream`]: crate::cli::AsyncStdinStream
#[derive(Clone)]
pub struct InputFile {
file: Arc<std::fs::File>,
diff --git a/crates/wasi/src/clocks.rs b/crates/wasi/src/clocks.rs
index 1ebc77ae81..0cac13a669 100644
--- a/crates/wasi/src/clocks.rs
+++ b/crates/wasi/src/clocks.rs
@@ -15,6 +15,8 @@ use wasmtime::component::{HasData, ResourceTable};
/// When using this type you can skip the [`WasiClocksView`] trait, for
/// example.
///
+/// [`wasmtime_wasi::p2::bindings::clocks::monotonic_clock::add_to_linker`]: crate::p2::bindings::clocks::monotonic_clock::add_to_linker
+///
/// # Examples
///
/// ```
diff --git a/crates/wasi/src/filesystem.rs b/crates/wasi/src/filesystem.rs
index c45abf5647..917defac77 100644
--- a/crates/wasi/src/filesystem.rs
+++ b/crates/wasi/src/filesystem.rs
@@ -18,6 +18,8 @@ use wasmtime::error::Context as _;
/// When using this type you can skip the [`WasiFilesystemView`] trait, for
/// example.
///
+/// [`wasmtime_wasi::p2::bindings::filesystem::types::add_to_linker`]: crate::p2::bindings::filesystem::types::add_to_linker
+///
/// # Examples
///
/// ```
@@ -660,9 +662,7 @@ pub struct File {
///
/// Wrapped in an Arc because the same underlying file is used for
/// implementing the stream types. A copy is also needed for
- /// [`spawn_blocking`].
- ///
- /// [`spawn_blocking`]: Self::spawn_blocking
+ /// `spawn_blocking`.
pub file: Arc<cap_std::fs::File>,
/// Permissions to enforce on access to the file. These permissions are
/// specified by a user of the `crate::WasiCtxBuilder`, and are
@@ -769,9 +769,7 @@ pub struct Dir {
/// The operating system file descriptor this struct is mediating access
/// to.
///
- /// Wrapped in an Arc because a copy is needed for [`spawn_blocking`].
- ///
- /// [`spawn_blocking`]: Self::spawn_blocking
+ /// Wrapped in an Arc because a copy is needed for `run_blocking`.
pub dir: Arc<cap_std::fs::Dir>,
/// Permissions to enforce on access to this directory. These permissions
/// are specified by a user of the `crate::WasiCtxBuilder`, and
diff --git a/crates/wasi/src/lib.rs b/crates/wasi/src/lib.rs
index 0c83b2aacd..78bcfd07b3 100644
--- a/crates/wasi/src/lib.rs
+++ b/crates/wasi/src/lib.rs
@@ -8,7 +8,7 @@
//! default.
//!
//! For components and WASIp2, see [`p2`].
-//! For WASIp1 and core modules, see the [`preview1`] module documentation.
+//! For WASIp1 and core modules, see the [`p1`] module documentation.
//!
//! For WASIp3, see [`p3`]. WASIp3 support is experimental, unstable and incomplete.
diff --git a/crates/wasi/src/p1.rs b/crates/wasi/src/p1.rs
index 689947f497..aa43f824e1 100644
--- a/crates/wasi/src/p1.rs
+++ b/crates/wasi/src/p1.rs
@@ -18,8 +18,8 @@
//! support in this module is enough to run wasm modules but any customization
//! beyond that [`WasiCtxBuilder`] already supports is not possible yet.
//!
-//! [`WasiCtxBuilder`]: crate::p2::WasiCtxBuilder
-//! [`build_p1`]: crate::p2::WasiCtxBuilder::build_p1
+//! [`WasiCtxBuilder`]: crate::WasiCtxBuilder
+//! [`build_p1`]: crate::WasiCtxBuilder::build_p1
//!
//! # Components vs Modules
//!
@@ -105,8 +105,8 @@ use wasmtime_wasi_io::bindings::wasi::io::poll::Host as _;
/// Instances of [`WasiP1Ctx`] are typically stored within the `T` of
/// [`Store<T>`](wasmtime::Store).
///
-/// [`WasiCtxBuilder::build_p1`]: crate::p2::WasiCtxBuilder::build_p1
-/// [`WasiCtxBuilder`]: crate::p2::WasiCtxBuilder
+/// [`WasiCtxBuilder::build_p1`]: crate::WasiCtxBuilder::build_p1
+/// [`WasiCtxBuilder`]: crate::WasiCtxBuilder
///
/// # Examples
///
diff --git a/crates/wasi/src/p2/mod.rs b/crates/wasi/src/p2/mod.rs
index 5685054a26..3c1431e83d 100644
--- a/crates/wasi/src/p2/mod.rs
+++ b/crates/wasi/src/p2/mod.rs
@@ -217,6 +217,13 @@
//! [`wasi:sockets/udp-create-socket`]: bindings::sockets::udp_create_socket::Host
//! [`wasi:sockets/udp`]: bindings::sockets::udp::Host
//! [`ResourceTable`]: wasmtime::component::ResourceTable
+//! [`WasiCtx`]: crate::WasiCtx
+//! [`WasiCtxView`]: crate::WasiCtxView
+//! [`WasiCtxBuilder`]: crate::WasiCtxBuilder
+//! [`WasiCtxBuilder::wall_clock`]: crate::WasiCtxBuilder::wall_clock
+//! [`WasiCtxBuilder::monotonic_clock`]: crate::WasiCtxBuilder::monotonic_clock
+//! [`StdinStream`]: crate::cli::StdinStream
+//! [`StdoutStream`]: crate::cli::StdoutStream
use crate::WasiView;
use crate::cli::{WasiCli, WasiCliView as _};
diff --git a/crates/wasi/src/random.rs b/crates/wasi/src/random.rs
index 0e6337a9c3..1a133e352f 100644
--- a/crates/wasi/src/random.rs
+++ b/crates/wasi/src/random.rs
@@ -11,6 +11,8 @@ use wasmtime::component::HasData;
/// When using this type you can skip the [`WasiRandomView`] trait, for
/// example.
///
+/// [`wasmtime_wasi::p2::bindings::random::random::add_to_linker`]: crate::p2::bindings::random::random::add_to_linker
+///
/// # Examples
///
/// ```
diff --git a/crates/wasi/src/sockets/mod.rs b/crates/wasi/src/sockets/mod.rs
index 55572c2acd..2cb38271ee 100644
--- a/crates/wasi/src/sockets/mod.rs
+++ b/crates/wasi/src/sockets/mod.rs
@@ -24,6 +24,8 @@ pub use udp::UdpSocket;
/// When using this type you can skip the [`WasiSocketsView`] trait, for
/// example.
///
+/// [`wasmtime_wasi::p2::bindings::sockets::tcp::add_to_linker`]: crate::p2::bindings::sockets::tcp::add_to_linker
+///
/// # Examples
///
/// ```
diff --git a/crates/wasi/src/view.rs b/crates/wasi/src/view.rs
index 2b96ec49e0..effdec9f62 100644
--- a/crates/wasi/src/view.rs
+++ b/crates/wasi/src/view.rs
@@ -7,7 +7,7 @@ use wasmtime::component::ResourceTable;
/// This crate's WASI Host implementations depend on the contents of
/// [`WasiCtx`]. The `T` type [`Store<T>`][`Store`] is defined in each
/// embedding of Wasmtime. These implementations are connected to the
-/// [`Linker<T>`][`Linker`] by [`add_to_linker`](crate::p2::add_to_linker)
+/// [`Linker<T>`][`Linker`] by [`add_to_linker_async`](crate::p2::add_to_linker_async)
/// functions.
///
/// # Example
diff --git a/crates/wasmtime/src/runtime/code_memory.rs b/crates/wasmtime/src/runtime/code_memory.rs
index a66029cec4..bf712c2423 100644
--- a/crates/wasmtime/src/runtime/code_memory.rs
+++ b/crates/wasmtime/src/runtime/code_memory.rs
@@ -321,7 +321,7 @@ impl CodeMemory {
///
/// After this function executes all JIT code should be ready to execute.
///
- /// The action may be reversed by calling [`unpublish`], as long
+ /// The action may be reversed by calling [`Self::unpublish`], as long
/// as that method's safety requirements are upheld.
pub fn publish(&mut self) -> Result<()> {
assert!(!self.published);
diff --git a/crates/wasmtime/src/runtime/component/concurrent.rs b/crates/wasmtime/src/runtime/component/concurrent.rs
index 395b967d37..113bdda063 100644
--- a/crates/wasmtime/src/runtime/component/concurrent.rs
+++ b/crates/wasmtime/src/runtime/component/concurrent.rs
@@ -351,7 +351,7 @@ where
/// This trait is similar to [`AsContextMut`] except that it's used when
/// working with an [`Accessor`] instead of a [`StoreContextMut`]. The
/// [`Accessor`] is the main type used in concurrent settings and is passed to
-/// functions such as [`Func::call_concurrent`] or [`FutureWriter::write`].
+/// functions such as [`Func::call_concurrent`].
///
/// This trait is implemented for [`Accessor`] and `&T` where `T` implements
/// this trait. This effectively means that regardless of the `D` in
@@ -361,7 +361,7 @@ where
/// Acquiring an [`Accessor`] can be done through
/// [`StoreContextMut::run_concurrent`] for example or in a host function
/// through
-/// [`Linker::func_wrap_concurrent`](crate::component::Linker::func_wrap_concurrent).
+/// [`Linker::func_wrap_concurrent`](crate::component::LinkerInstance::func_wrap_concurrent).
pub trait AsAccessor {
/// The `T` in `Store<T>` that this accessor refers to.
type Data: 'static;
@@ -943,7 +943,7 @@ impl<T> StoreContextMut<'_, T> {
/// Note that the task will only make progress if and when the event loop
/// for this instance is run.
///
- /// The returned [`SpawnHandle`] may be used to cancel the task.
+ /// The returned [`JoinHandle`] may be used to cancel the task.
pub fn spawn(mut self, task: impl AccessorTask<T>) -> JoinHandle
where
T: 'static,
diff --git a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
index 82c7ab3370..3bf53db135 100644
--- a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
+++ b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams.rs
@@ -1255,6 +1255,8 @@ impl<T> FutureReader<T> {
/// Panics if the store that the [`Accessor`] is derived from does not own
/// this future. Usage of this future after calling `close` will also cause
/// a panic.
+ ///
+ /// [`Accessor`]: crate::component::Accessor
pub fn close(&mut self, mut store: impl AsContextMut) {
future_close(store.as_context_mut().0, &mut self.id)
}
@@ -1441,6 +1443,8 @@ unsafe impl<T: ComponentType> func::Lift for FutureReader<T> {
/// This is an RAII wrapper around [`FutureReader`] that ensures it is closed
/// when dropped. This can be created through [`GuardedFutureReader::new`] or
/// [`FutureReader::guard`].
+///
+/// [`Accessor`]: crate::component::Accessor
pub struct GuardedFutureReader<T, A>
where
A: AsAccessor,
@@ -1786,6 +1790,8 @@ unsafe impl<T: ComponentType> func::Lift for StreamReader<T> {
/// This is an RAII wrapper around [`StreamReader`] that ensures it is closed
/// when dropped. This can be created through [`GuardedStreamReader::new`] or
/// [`StreamReader::guard`].
+///
+/// [`Accessor`]: crate::component::Accessor
pub struct GuardedStreamReader<T, A>
where
A: AsAccessor,
diff --git a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams/buffers.rs b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams/buffers.rs
index 7fc10d3fe0..8a7f2f14c7 100644
--- a/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams/buffers.rs
+++ b/crates/wasmtime/src/runtime/component/concurrent/futures_and_streams/buffers.rs
@@ -85,7 +85,7 @@ mod untyped {
/// Trait representing a buffer which may be written to a `StreamWriter`.
///
-/// See also [`crate::component::Instance::stream`].
+/// See also [`crate::component::StreamProducer`].
///
/// # Unsafety
///
@@ -117,7 +117,7 @@ pub unsafe trait WriteBuffer<T>: Send + Sync + 'static {
/// Trait representing a buffer which may be used to read from a `StreamReader`.
///
-/// See also [`crate::component::Instance::stream`].
+/// See also [`crate::component::Source`].
pub trait ReadBuffer<T>: Send + Sync + 'static {
/// Move the specified items into this buffer.
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I);
diff --git a/crates/wasmtime/src/runtime/component/func.rs b/crates/wasmtime/src/runtime/component/func.rs
index 4bfad04bbc..0a8cbd9f49 100644
--- a/crates/wasmtime/src/runtime/component/func.rs
+++ b/crates/wasmtime/src/runtime/component/func.rs
@@ -733,7 +733,7 @@ impl Func {
}
/// Exactly like [`Self::post_return`] except for invoke WebAssembly
- /// [asynchronously](crate::#async).
+ /// [asynchronously](crate#async).
#[cfg(feature = "async")]
pub async fn post_return_async(&self, mut store: impl AsContextMut<Data: Send>) -> Result<()> {
let mut store = store.as_context_mut();
diff --git a/crates/wasmtime/src/runtime/component/func/typed.rs b/crates/wasmtime/src/runtime/component/func/typed.rs
index bc81692c38..c03d08a97b 100644
--- a/crates/wasmtime/src/runtime/component/func/typed.rs
+++ b/crates/wasmtime/src/runtime/component/func/typed.rs
@@ -276,6 +276,8 @@ where
/// Panics if the store that the [`Accessor`] is derived from does not own
/// this function.
///
+ /// [`Accessor`]: crate::component::Accessor
+ ///
/// # Example
///
/// Using [`StoreContextMut::run_concurrent`] to get an [`Accessor`]:
diff --git a/crates/wasmtime/src/runtime/component/resources/host_dynamic.rs b/crates/wasmtime/src/runtime/component/resources/host_dynamic.rs
index 8f49f0dec1..c3491b3ba2 100644
--- a/crates/wasmtime/src/runtime/component/resources/host_dynamic.rs
+++ b/crates/wasmtime/src/runtime/component/resources/host_dynamic.rs
@@ -52,8 +52,8 @@ use wasmtime_environ::component::{CanonicalAbiInfo, InterfaceType};
/// a runtime-defined type. For example an embedding that provides generic
/// access to types in the host may want to take advantage of the dynamic nature
/// of this type. Resources of type [`ResourceDynamic`] have a type of
-/// [`ResourceType::host_dynamic(ty)`] where `ty` is the value provided to the
-/// constructors of [`ResourceDynamic`].
+/// [`ResourceType::host_dynamic(ty)`](ResourceType::host_dynamic) where `ty` is
+/// the value provided to the constructors of [`ResourceDynamic`].
///
/// A [`ResourceDynamic`] implements [`Lift`] and [`Lower`] in the same manner
/// as [`Resource`], but the implementations may fail after type-checking unlike
diff --git a/crates/wasmtime/src/runtime/debug.rs b/crates/wasmtime/src/runtime/debug.rs
index ac4f0568f0..67c7e4caee 100644
--- a/crates/wasmtime/src/runtime/debug.rs
+++ b/crates/wasmtime/src/runtime/debug.rs
@@ -680,7 +680,7 @@ impl<'a, T: 'static> AsContextMut for DebugFrameCursor<'a, T> {
/// a debug handler attached.
#[derive(Debug)]
pub enum DebugEvent<'a> {
- /// A [`wasmtime::Error`] was raised by a hostcall.
+ /// A [`wasmtime::Error`](crate::Error) was raised by a hostcall.
HostcallError(&'a crate::Error),
/// An exception is thrown and caught by Wasm. The current state
/// is at the throw-point.
@@ -739,6 +739,8 @@ pub enum DebugEvent<'a> {
/// another async stack, and the stack that polls the future
/// running a particular Wasm invocation could change after each
/// suspend point in the handler.
+///
+/// [`Store::run_concurrent`]: crate::Store::run_concurrent
pub trait DebugHandler: Clone + Send + Sync + 'static {
/// The data expected on the store that this handler is attached
/// to.
diff --git a/crates/wasmtime/src/runtime/exception.rs b/crates/wasmtime/src/runtime/exception.rs
index 69b2cf78ea..d5a70b9720 100644
--- a/crates/wasmtime/src/runtime/exception.rs
+++ b/crates/wasmtime/src/runtime/exception.rs
@@ -29,8 +29,9 @@
/// When used as an error type and returned from a Wasm-to-host call,
/// or host-to-Wasm call, it indicates that the caller should either
/// continue propagating the error upward, or take and handle the
-/// exception using [`crate::Store::take_exception`] (or a helper such
-/// as [`crate::Store::catch`].
+/// exception using [`Store::take_pending_exception`].
+///
+/// [`Store::take_pending_exception`]: crate::Store::take_pending_exception
///
/// Wasmtime uses an error type *without* payload, and stores the
/// exception itself on the store, to maintain proper GC rooting;
diff --git a/crates/wasmtime/src/runtime/externals/tag.rs b/crates/wasmtime/src/runtime/externals/tag.rs
index 62ee4a89f9..11694fa71f 100644
--- a/crates/wasmtime/src/runtime/externals/tag.rs
+++ b/crates/wasmtime/src/runtime/externals/tag.rs
@@ -24,14 +24,6 @@ impl Tag {
}
/// Create a new tag instance from a given TagType.
- ///
- /// # Panics
- ///
- /// This function will panic when used with a [`Store`](`crate::Store`)
- /// which has a [`ResourceLimiterAsync`](`crate::ResourceLimiterAsync`)
- /// (see also: [`Store::limiter_async`](`crate::Store::limiter_async`).
- /// When using an async resource limiter, use [`Tag::new_async`]
- /// instead.
pub fn new(mut store: impl AsContextMut, ty: &TagType) -> Result<Tag> {
generate_tag_export(store.as_context_mut().0, ty)
}
diff --git a/crates/wasmtime/src/runtime/func.rs b/crates/wasmtime/src/runtime/func.rs
index 1445fc1b64..d8ce50167f 100644
--- a/crates/wasmtime/src/runtime/func.rs
+++ b/crates/wasmtime/src/runtime/func.rs
@@ -1858,8 +1858,7 @@ macro_rules! impl_into_func {
for_each_function_signature!(impl_into_func);
/// Trait implemented for various tuples made up of types which implement
-/// [`WasmTy`] that can be passed to [`Func::wrap_async`] and
-/// [`HostContext::new_typed`].
+/// [`WasmTy`] that can be passed to [`Func::wrap_async`].
pub unsafe trait WasmTyList {
/// Get the value type that each Type in the list represents.
fn valtypes() -> impl Iterator<Item = ValType>;
@@ -1978,14 +1977,19 @@ impl<T> Caller<'_, T> {
/// Looks up an exported [`Extern`] value by a [`ModuleExport`] value.
///
- /// This is similar to [`Self::get_export`] but uses a [`ModuleExport`] value to avoid
- /// string lookups where possible. [`ModuleExport`]s can be obtained by calling
- /// [`Module::get_export_index`] on the [`Module`] that an instance was instantiated with.
+ /// This is similar to [`Self::get_export`] but uses a [`ModuleExport`]
+ /// value to avoid string lookups where possible. [`ModuleExport`]s can be
+ /// obtained by calling [`Module::get_export_index`] on the [`Module`] that
+ /// an instance was instantiated with.
///
/// This method will search the module for an export with a matching entity index and return
/// the value, if found.
///
/// Returns `None` if there was no export with a matching entity index.
+ ///
+ /// [`Module::get_export_index`]: crate::Module::get_export_index
+ /// [`Module`]: crate::Module
+ ///
/// # Panics
///
/// Panics if `store` does not own this instance.
@@ -2110,7 +2114,9 @@ impl<T> Caller<'_, T> {
/// VM-level values (locals and operand stack), when debugging is
/// enabled.
///
- /// See ['Store::debug_frames`] for more details.
+ /// See [`Store::debug_frames`] for more details.
+ ///
+ /// [`Store::debug_frames`]: crate::Store::debug_frames
#[cfg(feature = "debug")]
pub fn debug_frames(&mut self) -> Option<crate::DebugFrameCursor<'_, T>> {
self.store.as_context_mut().debug_frames()
@@ -2180,8 +2186,9 @@ impl core::fmt::Debug for HostFunc {
}
impl HostFunc {
- /// Requires that the signatuer in `HostContext` is already registered
- /// within `Engine`, which is done by `HostContext`'s constructors.
+ /// Requires that the signature in `ctx` is already registered
+ /// within `Engine`, which is done by [`Self::vmctx_sync`] and
+ /// [`Self::vmctx_async`].
///
/// This is an internal private constructor for this type intended to only
/// be used by other constructors of this type below.
diff --git a/crates/wasmtime/src/runtime/gc/enabled/rooting.rs b/crates/wasmtime/src/runtime/gc/enabled/rooting.rs
index 3f40d856e3..9b1976fa90 100644
--- a/crates/wasmtime/src/runtime/gc/enabled/rooting.rs
+++ b/crates/wasmtime/src/runtime/gc/enabled/rooting.rs
@@ -1524,8 +1524,7 @@ where
///
/// An `OwnedRooted<T>` is a strong handle to a garbage-collected `T`,
/// preventing its referent (and anything else transitively referenced) from
-/// being collected by the GC until [`unroot`][crate::OwnedRooted::unroot] is
-/// explicitly called.
+/// being collected by the GC until it is dropped.
///
/// An `OwnedRooted<T>` keeps its rooted GC object alive at least
/// until the `OwnedRooted<T>` itself is dropped. The
diff --git a/crates/wasmtime/src/runtime/store.rs b/crates/wasmtime/src/runtime/store.rs
index 9af681b3b1..dc2a2ce3d0 100644
--- a/crates/wasmtime/src/runtime/store.rs
+++ b/crates/wasmtime/src/runtime/store.rs
@@ -200,6 +200,8 @@ mod gc;
/// operations is incorrect. In other words it's considered a programmer error
/// rather than a recoverable error for the wrong [`Store`] to be used when
/// calling APIs.
+///
+/// [`Memory`]: crate::Memory
pub struct Store<T: 'static> {
// for comments about `ManuallyDrop`, see `Store::into_data`
inner: ManuallyDrop<Box<StoreInner<T>>>,
@@ -1009,6 +1011,8 @@ impl<T> Store<T> {
///
/// After this function returns a trap, it may be called for subsequent returns
/// to host or wasm code as the trap propagates to the root call.
+ ///
+ /// [`Trap`]: crate::Trap
#[cfg(feature = "call-hook")]
pub fn call_hook(
&mut self,
@@ -1227,11 +1231,7 @@ impl<T> Store<T> {
/// `ThrownException` error type should propagate upward exactly
/// and only when a pending exception is set.
///
- /// To inspect or take the pending exception, use
- /// [`peek_pending_exception`] and [`take_pending_exception`]. For
- /// a convenient wrapper that invokes a closure and provides any
- /// caught exception from the closure to a separate handler
- /// closure, see [`StoreContextMut::catch`].
+ /// To take the pending exception, use [`Self::take_pending_exception`].
///
/// This method is parameterized over `R` for convenience, but
/// will always return an `Err`.
@@ -1262,7 +1262,7 @@ impl<T> Store<T> {
///
/// This method is useful to implement ad-hoc exception plumbing
/// in various ways, but for the most idiomatic handling, see
- /// [`StoreContextMut::catch`].
+ /// [`StoreContextMut::throw`].
#[cfg(feature = "gc")]
pub fn take_pending_exception(&mut self) -> Option<Rooted<ExnRef>> {
self.inner.take_pending_exception_rooted()
@@ -1274,13 +1274,13 @@ impl<T> Store<T> {
/// only if a host-side callstack is propagating a
/// [`crate::ThrownException`] error. The final consumer that
/// catches the exception takes it; it may re-place it to re-throw
- /// (using [`throw`]) if it chooses not to actually handle the
+ /// (using [`Self::throw`]) if it chooses not to actually handle the
/// exception.
///
/// This method is useful to tell whether a store is in this
/// state, but should not be used as part of the ordinary
/// exception-handling flow. For the most idiomatic handling, see
- /// [`StoreContextMut::catch`].
+ /// [`StoreContextMut::throw`].
#[cfg(feature = "gc")]
pub fn has_pending_exception(&self) -> bool {
self.inner.pending_exception.is_some()
diff --git a/crates/wasmtime/src/runtime/store/async_.rs b/crates/wasmtime/src/runtime/store/async_.rs
index c3e149f4ee..d28a3fd19f 100644
--- a/crates/wasmtime/src/runtime/store/async_.rs
+++ b/crates/wasmtime/src/runtime/store/async_.rs
@@ -81,6 +81,8 @@ impl<T> Store<T> {
///
/// After this function returns a trap, it may be called for subsequent
/// returns to host or wasm code as the trap propagates to the root call.
+ ///
+ /// [`Trap`]: crate::Trap
#[cfg(feature = "call-hook")]
pub fn call_hook_async(&mut self, hook: impl CallHookHandler<T> + Send + Sync + 'static) {
self.inner.call_hook = Some(crate::store::CallHookInner::Async(Box::new(hook)));
diff --git a/crates/wasmtime/src/runtime/trap.rs b/crates/wasmtime/src/runtime/trap.rs
index d0c3fa95b6..24027acd8d 100644
--- a/crates/wasmtime/src/runtime/trap.rs
+++ b/crates/wasmtime/src/runtime/trap.rs
@@ -20,8 +20,8 @@ use wasmtime_environ::{FilePos, demangle_function_name, demangle_function_name_o
/// # Errors in Wasmtime
///
/// Error-handling in Wasmtime is primarily done through the
-/// [`wasmtime::Error`][crate::Error] type where most results are a
-/// [`wasmtime::Result<T>`](crate::Result) which is an alias for [`Result<T,
+/// [`wasmtime::Error`] type where most results are a
+/// [`wasmtime::Result<T>`] which is an alias for [`Result<T,
/// wasmtime::Error>`](std::result::Result). Errors in Wasmtime are represented
/// with [`wasmtime::Error`] which acts as a container for any type of error in
/// addition to optional context for this error. The "base" error or
@@ -37,6 +37,10 @@ use wasmtime_environ::{FilePos, demangle_function_name, demangle_function_name_o
/// done with the [`downcast_ref`](crate::Error::downcast_ref) function. For
/// information on this see the [`WasmBacktrace`] documentation.
///
+/// [`wasmtime::Error`]: crate::Error
+/// [`wasmtime::Result<T>`]: crate::Result
+/// [`wasmtime::Error::root_cause`]: crate::Error::root_cause
+///
/// # Examples
///
/// ```
@@ -139,10 +143,11 @@ pub(crate) fn from_runtime_box(
///
/// This structure is attached to the [`wasmtime::Error`] returned from many
/// Wasmtime functions that execute WebAssembly such as [`Instance::new`] or
-/// [`Func::call`]. This can be acquired with the [`wasmtime::Error::downcast`]
-/// family of methods to programmatically inspect the backtrace. Otherwise since
-/// it's part of the error returned this will get printed along with the rest of
-/// the error when the error is logged.
+/// [`Func::call`]. This can be acquired with the
+/// [`Error::downcast`](crate::Error::downcast) family of methods to
+/// programmatically inspect the backtrace. Otherwise since it's part of the
+/// error returned this will get printed along with the rest of the error when
+/// the error is logged.
///
/// Capturing of wasm backtraces can be configured through the
/// [`Config::wasm_backtrace`](crate::Config::wasm_backtrace) method.
@@ -152,6 +157,7 @@ pub(crate) fn from_runtime_box(
///
/// [`Func::call`]: crate::Func::call
/// [`Instance::new`]: crate::Instance::new
+/// [`wasmtime::Error`]: crate::Error
///
/// # Examples
///
diff --git a/crates/wit-bindgen/src/lib.rs b/crates/wit-bindgen/src/lib.rs
index 426768977f..88a614eff2 100644
--- a/crates/wit-bindgen/src/lib.rs
+++ b/crates/wit-bindgen/src/lib.rs
@@ -459,7 +459,7 @@ impl Wasmtime {
#[allow(clippy::all)]
pub mod {snake} {{
#[allow(unused_imports)]
- use {wt}::component::__internal::{{Box}};
+ use {wt}::component::__internal::Box;
{module}
}}
diff --git a/crates/wizer/src/component/wasmtime.rs b/crates/wizer/src/component/wasmtime.rs
index 2379a95c37..b5785b821c 100644
--- a/crates/wizer/src/component/wasmtime.rs
+++ b/crates/wizer/src/component/wasmtime.rs
@@ -79,7 +79,7 @@ impl Wizer {
}
}
-/// Impementation of [`InstanceState`] backed by Wasmtime.
+/// Impementation of [`ComponentInstanceState`] backed by Wasmtime.
pub struct WasmtimeWizerComponent<'a, T: 'static> {
/// The Wasmtime-based store that owns the `instance` field.
pub store: &'a mut Store<T>,