3 ms·
> Only if you're willing to accept undefined behavior if the foreign code passes you an unknown variant. Isn't that what `#[non_exhaustive]` is for?
by ElderKorihor 5y ago
> Only if you're willing to accept undefined behavior if the foreign code passes you an unknown variant.
Isn't that what `#[non_exhaustive]` is for?
- gpm 5y agoAs far as I know that flag doesn't give you permission to create unknown variants or effect backend code generation that will assume there are only the defined variants. I could be wrong, but I don't see anything about this documented in the rfc: https://rust-lang.github.io/rfcs/2008-non-exhaustive.html https://rust-lang.github.io/rfcs/2008-non-exhaustive.html