mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-24 07:44:10 +00:00
23 lines
385 B
Rust
23 lines
385 B
Rust
//! Check that array lengths can observe associated types of opaque types
|
|
//@ check-pass
|
|
trait MyTrait: Copy {
|
|
const ASSOC: usize;
|
|
}
|
|
|
|
impl MyTrait for u8 {
|
|
const ASSOC: usize = 32;
|
|
}
|
|
|
|
const fn yeet() -> impl MyTrait {
|
|
0u8
|
|
}
|
|
|
|
const fn output<T: MyTrait>(_: T) -> usize {
|
|
<T as MyTrait>::ASSOC
|
|
}
|
|
|
|
fn main() {
|
|
let x = [0u8; output(yeet())];
|
|
println!("{:?}", x);
|
|
}
|