1 // Test that `variant_count` only gets evaluated once the type is concrete enough.
3 #![feature(variant_count)]
5 pub struct GetVariantCount<T>(T);
7 impl<T> GetVariantCount<T> {
8 pub const VALUE: usize = std::mem::variant_count::<T>();
11 const fn check_variant_count<T>() -> bool {
12 matches!(GetVariantCount::<T>::VALUE, GetVariantCount::<T>::VALUE)
13 //~^ ERROR constant pattern depends on a generic parameter
14 //~| ERROR constant pattern depends on a generic parameter
18 assert!(check_variant_count::<Option<()>>());