use #[non_exhaustive] for generated enums
Since Rust 1.40 we can use the non_exhaustive attribute to indicate that
more variants may be added in the future.
Adding variants to a C enum is not an API break so it makes sense to
mark all the generated enum as non exhaustive.
Fix
@@ -145,6 +145,7 @@ fn generate_enum(
writeln!(w, "#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]")?;
}
writeln!(w, "#[derive(Clone, Copy)]")?;
+ writeln!(w, "#[non_exhaustive]")?;
writeln!(w, "pub enum {} {{", enum_.name)?;
for member in &members {
