rusticl/api: Interpret `lengths` as a slice of Option<NonZeroUsize>
authorLingMan <18294-LingMan@users.noreply.gitlab.freedesktop.org>
Wed, 5 Oct 2022 21:59:14 +0000 (23:59 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 19 Oct 2022 23:32:50 +0000 (23:32 +0000)
commitada1076f98ea2b24491dd4fd1b25208cbed9caa7
treee7311ff9e92a2468b07b987cd765e774ea72a674
parent5c16065169fe4ad8085bcd5ff51752306d0f58ff
rusticl/api: Interpret `lengths` as a slice of Option<NonZeroUsize>

So far `lengths` as been interpreted as a slice of usize. However, 0 is specified as a sentinel
value signalling that the corresponding string is nul terminated. Since checking for sentinel
values is frequently forgotten, Option types should be preferred if possible.

Option<NonZeroUsize> is layout compatible with usize. The None variant is then represented as 0,
which is exaclty what we need here.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18978>
src/gallium/frontends/rusticl/api/program.rs