2 #![feature(const_generics, const_evaluatable_checked)]
3 #![allow(incomplete_features)]
5 pub trait BlockCipher {
6 const BLOCK_SIZE: usize;
10 impl BlockCipher for FooCipher {
11 const BLOCK_SIZE: usize = 64;
15 impl BlockCipher for BarCipher {
16 const BLOCK_SIZE: usize = 32;
19 pub struct Block<C>(C);
21 pub fn test<C: BlockCipher, const M: usize>()
23 [u8; M - C::BLOCK_SIZE]: Sized,
25 let _ = [0; M - C::BLOCK_SIZE];
29 test::<FooCipher, 128>();
30 test::<BarCipher, 64>();