mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
19 lines
364 B
Rust
19 lines
364 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;
|
|
}
|