Skip to main content

wasmtime_environ/
lib.rs

1//! Internal dependency of the `wasmtime` crate.
2//!
3//! This crate is responsible for defining types and basic runtime structures
4//! used by the `wasmtime` crate. This additionally defines primitives of
5//! compilation and what compilers are expected to emit.
6//!
7//! If you don't already know what this crate is you probably want to use
8//! `wasmtime`, not this crate.
9
10#![deny(missing_docs)]
11#![warn(clippy::cast_sign_loss)]
12#![no_std]
13// `for_each_vm_type!`'s offset generation recurses once per field of a type,
14// and some of our `VM*` types have enough fields to exceed the default.
15#![recursion_limit = "512"]
16
17#[cfg(any(feature = "std", test))]
18#[macro_use]
19extern crate std;
20extern crate alloc;
21
22pub mod collections;
23pub mod graphs;
24pub mod prelude;
25
26mod address_map;
27mod frame_table;
28#[macro_use]
29mod builtin;
30pub mod bytes;
31mod demangling;
32mod ext;
33mod gc;
34mod hostcall;
35mod key;
36mod module;
37mod module_artifacts;
38mod module_types;
39pub mod obj;
40mod ref_bits;
41mod scopevec;
42mod stack_map;
43mod stack_switching;
44mod string_pool;
45mod trap_encoding;
46mod tunables;
47mod types;
48#[cfg(all(feature = "component-model", feature = "compile"))]
49mod union_find;
50#[macro_use]
51mod vmctxtypes;
52#[macro_use]
53mod vmtypes;
54mod vmoffsets;
55mod wasm_error;
56
57pub use self::ext::*;
58pub use crate::address_map::*;
59pub use crate::builtin::*;
60pub use crate::demangling::*;
61pub use crate::frame_table::*;
62pub use crate::gc::*;
63pub use crate::hostcall::*;
64pub use crate::key::*;
65pub use crate::module::*;
66pub use crate::module_artifacts::*;
67pub use crate::module_types::*;
68pub use crate::ref_bits::*;
69pub use crate::scopevec::ScopeVec;
70pub use crate::stack_map::*;
71pub use crate::stack_switching::*;
72pub use crate::string_pool::{Atom, StringPool};
73pub use crate::trap_encoding::*;
74pub use crate::tunables::*;
75pub use crate::types::*;
76pub use crate::vmctxtypes::{ArrayOffsets, VmctxArrayIndex};
77pub use crate::vmoffsets::*;
78pub use crate::wasm_error::*;
79pub use object;
80
81pub use wasmparser;
82
83#[cfg(feature = "compile")]
84mod compile;
85#[cfg(feature = "compile")]
86pub use crate::compile::*;
87
88#[cfg(feature = "component-model")]
89pub mod component;
90#[cfg(all(feature = "component-model", feature = "compile"))]
91pub mod fact;
92
93// Reexport all of these type-level since they're quite commonly used and it's
94// much easier to refer to everything through one crate rather than importing
95// one of three and making sure you're using the right one.
96pub use cranelift_entity::*;
97
98// Reexport the error module for convenience.
99pub use self::error::ToWasmtimeResult;
100#[doc(inline)]
101pub use wasmtime_core::error;
102
103pub use wasmtime_core::{alloc::PanicOnOom, non_max, undo::Undo};
104
105// Only for use with `bindgen!`-generated code.
106#[doc(hidden)]
107#[cfg(feature = "anyhow")]
108pub use anyhow;
109
110/// Version number of this crate.
111pub const VERSION: &str = env!("CARGO_PKG_VERSION");
112
113/// A `mutatis` check pre-configured with a MIRI-aware number of iterations to
114/// run.
115#[cfg(all(test, feature = "component-model", feature = "compile"))]
116fn property_check() -> mutatis::check::Check {
117    let mut check = mutatis::check::Check::new();
118    if cfg!(miri) {
119        check.iters(2).shrink_iters(0);
120    }
121    check
122}