itsrainy requested alexcrichton for a review on PR #5013.
itsrainy opened PR #5013 from rainy/minor-fuel-changes
to main
:
I ran into this when attempting to use
set_fuel
in a fuzz target (https://github.com/bytecodealliance/wasm-tools/pull/769).set_fuel
callsconsume_fuel(0)
in order to get the current amount of fuel in a Store. However,consume_fuel(0)
will return an out of fuel error if there is 0 fuel remaining, which is the case with a new Store.Switching the
<
to a<=
also has the effect of making this work:... let mut store = Store::new(&engine, ()); store.add_fuel(1).unwrap(); store.consume_fuel(1).unwrap();
previously this would have returned an "out of fuel" error, which doesn't seem correct, though maybe there's some nuance I'm missing?
itsrainy updated PR #5013 from rainy/minor-fuel-changes
to main
.
alexcrichton submitted PR review.
alexcrichton merged PR #5013.
Last updated: Nov 22 2024 at 17:03 UTC