You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Disallow the value 0 in from_handle methods in the Rust bindings. (#1318)
The canonical ABI for its part [guarantees] the value 0 will not be used
as a table index. Should users of the Rust bindings be able to construct
handle types with the value 0?
If we say yes, then handle types act as if they have an internal `Option`
type that gets implicitly unwrapped when passed to an import.
However, in this PR I propose to say no, and prohibit zero in handle types.
It seems tidier to say that code depending on optionality should explicitly
use `Option` for itself, which will then help avoid traping, by
construction. And even if we can't do niche optimizations today due to the
`AtomicU32`, it is theoretically possible we could do something with
`NonZeroU32` in the future.
[guarantees]: https://github.com/WebAssembly/component-model/blob/main/design/mvp/CanonicalABI.md#table-state
0 commit comments