Skip to content

Commit 57b59af

Browse files
Add note about non_exhaustive to variant_count
1 parent 2b681ac commit 57b59af

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

library/core/src/mem/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,10 @@ pub const fn discriminant<T>(v: &T) -> Discriminant<T> {
10451045
/// return value is unspecified. Equally, if `T` is an enum with more variants than `usize::MAX`
10461046
/// the return value is unspecified. Uninhabited variants will be counted.
10471047
///
1048+
/// Note that an enum may be expanded with additional variants in the future
1049+
/// as a non-breaking change, for example if it is marked `#[non_exhaustive]`,
1050+
/// which will change the result of this function.
1051+
///
10481052
/// # Examples
10491053
///
10501054
/// ```

0 commit comments

Comments
 (0)