//@ known-bug: #116519 #![allow(incomplete_features)] #![feature(generic_const_exprs)] trait Ret { type R; } struct Cond(std::marker::PhantomData, std::marker::PhantomData); impl Ret for Cond { type R = U; } impl Ret for Cond { type R = V; } struct RobinHashTable< const MAX_LENGTH: usize, CellIdx = as Ret>::R, > { _idx: CellIdx, } impl RobinHashTable { fn new() -> Self { Self { _idx: CellIdx { MAX_LENGTH }, } } } impl HashMapBase { fn new() -> Self { Self { _idx: CellIdx { 0 }, } } } impl HashMapBase for RobinHashTable { fn hash(&self, ) -> H { self._idx.hash() } fn eq(&self, other: &Self) -> bool { self._idx.eq(other._idx) } } impl HashMapBase for RobinHashTable { fn hash(&self, other: &Self) -> H { self._idx.hash(other._idx) } fn eq(&self, other: &Self) -> bool { self._idx.eq(other._idx) } } #[test] fn test_size_of_robin_hash_table() { use std::mem::size_of; println!("{}", size_of::>()); println!("{}", size_of::>()); }