fitzgen commented on Issue #1307:
We should probably not have only "infallible" constructors for entity indices, when you can give "invalid" inputs to them... That is, I think we should have
FuncIndex::try_from_u32(u32) -> Result<Self, SomeErrorType>
FuncIndex::from_u32(u32) -> Self
and panics if givenu32::MAX
FuncIndex::from_u32_unchecked(u32) -> Self
which only debug-asserts that it is not givenu32::MAX
(aka the current behavior offrom_u32
)But this is a bit more invasive and has implications across cranelift, so I've opted not to do it, for now at least.
sunfishcode commented on Issue #1307:
Also, fwiw, your suggestion about
try_from_u32
etc. makes sense to me.
fitzgen commented on Issue #1307:
Is it feasible to check in the test file in wat format, rather than wasm?
Not that I know of (I could be wrong!) since this is something that requires semi-bogus custom section data. I don't know how to write WAT like that.
fitzgen commented on Issue #1307:
it's useful to give the test a descriptive name
Updated the name to
issue-1306-name-section-with-u32-max-function-index.wasm
, let me know if you want it to be something else.
Last updated: Nov 22 2024 at 16:03 UTC