rust/tests/ui/associated-consts/mismatched_impl_ty_1.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

19 lines
364 B
Rust
Raw Normal View History

//@ 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;
}