rust/tests/ui/const-generics/issues/issue-62187-encountered-polymorphic-const.rs

13 lines
195 B
Rust
Raw Normal View History

2019-10-07 16:01:58 -05:00
// run-pass
pub trait BitLen: Sized {
const BIT_LEN: usize;
}
impl<const L: usize> BitLen for [u8; L] {
const BIT_LEN: usize = 8 * L;
}
fn main() {
2020-09-10 02:04:14 -05:00
let _foo = <[u8; 2]>::BIT_LEN;
2019-10-07 16:01:58 -05:00
}