From 4312cabc4ba711985b441366c85f842177789fdf Mon Sep 17 00:00:00 2001 From: Jimmy Bourassa Date: Tue, 29 Nov 2022 12:08:52 -0500 Subject: [PATCH] Fuel documentation fixes (#5343) - `Store::add_fuel` documentation said it'd panic when the engine is not configured to have fuel, but it in fact returns an error[1]. - There was a typo in `Store::add_fuel`'s documentation (either either). I "fixed" the typo by rewording the section using the same wording as `Store::fuel_consumed` (_if fuel consumption is not enabled via..._) [1]https://github.com/bytecodealliance/wasmtime/blob/ff5abfd9938c78cd75c6c5d6a41565097128c5d3/crates/wasmtime/src/store.rs#L1397-L1400 --- crates/wasmtime/src/store.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/wasmtime/src/store.rs b/crates/wasmtime/src/store.rs index ae0753ad3a..92ed270865 100644 --- a/crates/wasmtime/src/store.rs +++ b/crates/wasmtime/src/store.rs @@ -766,10 +766,10 @@ impl Store { /// Note that at this time when fuel is entirely consumed it will cause /// wasm to trap. More usages of fuel are planned for the future. /// - /// # Panics + /// # Errors /// - /// This function will panic if the store's [`Config`](crate::Config) did - /// not have fuel consumption enabled. + /// This function will return an error if fuel consumption is not enabled via + /// [`Config::consume_fuel`](crate::Config::consume_fuel). pub fn add_fuel(&mut self, fuel: u64) -> Result<()> { self.inner.add_fuel(fuel) } @@ -790,9 +790,9 @@ impl Store { /// /// # Errors /// - /// This function will return an either either if fuel consumption via - /// [`Config`](crate::Config) is disabled or if `fuel` exceeds the amount - /// of remaining fuel within this store. + /// This function will return an error either if fuel consumption is not + /// enabled via [`Config::consume_fuel`](crate::Config::consume_fuel) or if + /// `fuel` exceeds the amount of remaining fuel within this store. pub fn consume_fuel(&mut self, fuel: u64) -> Result { self.inner.consume_fuel(fuel) }