Skip to content

Commit dbe8ed9

Browse files
fnetzemilio
authored andcommitted
Add undefined behaviour warning to rustified_non_exhaustive_enum
1 parent 50ec3ee commit dbe8ed9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

bindgen/options/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,11 @@ options! {
541541
///
542542
/// This is similar to the [`Builder::rustified_enum`] style, but the `enum` is
543543
/// tagged with the `#[non_exhaustive]` attribute.
544+
///
545+
/// **Use this with caution**, creating an instance of a Rust `enum` with an
546+
/// invalid value will cause undefined behaviour, even if it's tagged with
547+
/// `#[non_exhaustive]`. To avoid this, use the [`Builder::newtype_enum`] style
548+
/// instead.
544549
pub fn rustified_non_exhaustive_enum<T: AsRef<str>>(mut self, arg: T) -> Builder {
545550
self.options.rustified_non_exhaustive_enums.insert(arg);
546551
self

0 commit comments

Comments
 (0)