A lightweight WebAssembly runtime that is fast, secure, and standards-compliant
Document that fuel is not precise on traps (#15091)
Alex Crichton2632f13f8016
diff --git a/crates/wasmtime/src/config.rs b/crates/wasmtime/src/config.rsindex c1aa69bf5e..717a11a1f0 100644--- a/crates/wasmtime/src/config.rs+++ b/crates/wasmtime/src/config.rs@@ -637,9 +637,20 @@ impl Config {/// you'll have to be sure to pour some fuel into [`Store`] before/// executing some code.///+ /// Fuel accounting is not precise when WebAssembly traps. Each call is+ /// still bounded by the fuel in the [`Store`], but the amount of fuel+ /// listed as being consumed when WebAssembly traps may not accurately+ /// reflect the exact amount that was consumed. This tradeoff enables+ /// Wasmtime to optimize fuel-consumption primarily while still ensuring+ /// that non-trapping code is always bounded. Embedders which need precise+ /// fuel consumption metrics should not reuse a [`Store`] after a trap and+ /// should not rely on the precise value of [`Store::get_fuel`] in the event+ /// of a trap.+ ////// By default this option is `false`.////// [`Store`]: crate::Store+ /// [`Store::get_fuel`]: crate::Store::get_fuelpub fn consume_fuel(&mut self, enable: bool) -> &mut Self {self.tunables.consume_fuel = Some(enable);self