mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-27 17:24:06 +00:00
27 lines
359 B
Rust
27 lines
359 B
Rust
// build-pass
|
|
|
|
#![allow(incomplete_features)]
|
|
#![feature(generic_const_exprs)]
|
|
|
|
pub trait Foo {
|
|
const SIZE: usize;
|
|
|
|
fn to_bytes(&self) -> [u8; Self::SIZE];
|
|
}
|
|
|
|
pub fn bar<G: Foo>(a: &G) -> u8
|
|
where
|
|
[(); G::SIZE]: Sized,
|
|
{
|
|
deeper_bar(a)
|
|
}
|
|
|
|
fn deeper_bar<G: Foo>(a: &G) -> u8
|
|
where
|
|
[(); G::SIZE]: Sized,
|
|
{
|
|
a.to_bytes()[0]
|
|
}
|
|
|
|
fn main() {}
|