]> git.lizzy.rs Git - rust.git/blob - tests/ui/consts/issue-79137-monomorphic.rs
Rollup merge of #106949 - compiler-errors:is-poly, r=BoxyUwU
[rust.git] / tests / ui / consts / issue-79137-monomorphic.rs
1 // check-pass
2
3 // Verify that variant count intrinsic can still evaluate for types like `Option<T>`.
4
5 #![feature(variant_count)]
6
7 pub struct GetVariantCount<T>(T);
8
9 impl<T> GetVariantCount<T> {
10     pub const VALUE: usize = std::mem::variant_count::<T>();
11 }
12
13 const fn check_variant_count<T>() -> bool {
14     matches!(GetVariantCount::<Option<T>>::VALUE, GetVariantCount::<Option<()>>::VALUE)
15 }
16
17 fn main() {
18     assert!(check_variant_count::<()>());
19 }