]> git.proxmox.com Git - rustc.git/blob - src/test/ui/consts/issue-79137-monomorphic.rs
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / 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 }