From 57b59af9fb642791a155a446fe965029227ea07a Mon Sep 17 00:00:00 2001 From: Mark Rousskov Date: Tue, 4 Jan 2022 21:57:33 -0500 Subject: [PATCH] Add note about non_exhaustive to variant_count --- library/core/src/mem/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/library/core/src/mem/mod.rs b/library/core/src/mem/mod.rs index 7d005666a74..989ec0639cd 100644 --- a/library/core/src/mem/mod.rs +++ b/library/core/src/mem/mod.rs @@ -1045,6 +1045,10 @@ pub const fn discriminant(v: &T) -> Discriminant { /// return value is unspecified. Equally, if `T` is an enum with more variants than `usize::MAX` /// the return value is unspecified. Uninhabited variants will be counted. /// +/// Note that an enum may be expanded with additional variants in the future +/// as a non-breaking change, for example if it is marked `#[non_exhaustive]`, +/// which will change the result of this function. +/// /// # Examples /// /// ```