rust/tests/ui/associated-consts/mismatched_impl_ty_1.rs
2023-01-11 09:32:08 +00:00

19 lines
363 B
Rust

// run-pass
#![feature(generic_const_exprs)]
#![allow(incomplete_features)]
trait MyTrait {
type ArrayType;
const SIZE: usize;
const ARRAY: Self::ArrayType;
}
impl MyTrait for () {
type ArrayType = [u8; Self::SIZE];
const SIZE: usize = 4;
const ARRAY: [u8; Self::SIZE] = [1, 2, 3, 4];
}
fn main() {
let _ = <() as MyTrait>::ARRAY;
}