Skip to content

Commit 7f7b3b6

Browse files
authored
Rollup merge of rust-lang#92568 - Mark-Simulacrum:non-exhaustive-variant-count, r=the8472
Add note about non_exhaustive to variant_count Since `variant_count` isn't returning something opaque, I thought it makes sense to explicitly call out that its return value may change for some enums. cc rust-lang#73662
2 parents 2486a8a + 57b59af commit 7f7b3b6

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)