-
Notifications
You must be signed in to change notification settings - Fork 20
Description
The Level enum has always had variants that might not be present depending on the target architecture--for instance, Level::Neon doesn't exist on anything other than aarch64.
However, #105 changes things so that Level::Fallback can now also be absent. This means that depending on the architecture and statically-enabled target features, every enum variant has a chance of being missing. As a result, trying to match on the Level enum is a footgun--there is always some architecture on which the match statement will fail.
I ran into this trying to port Vello to the latest (unreleased) version of fearless_simd; it extensively uses matches!(level, Level::Fallback(_)).
This makes me wonder if we should move the enum part of Level into a private field, making it impossible to match on it entirely. If needed, we could add always-present methods like Level::is_fallback(), Level::is_neon(), etc. that return false if the architecture doesn't match.