]> git.lizzy.rs Git - rust.git/blob - tests/ui/const-generics/issues/issue-89146.rs
Rollup merge of #106707 - ehuss:remove-dupe-sha-1, r=Mark-Simulacrum
[rust.git] / tests / ui / const-generics / issues / issue-89146.rs
1 // build-pass
2
3 #![allow(incomplete_features)]
4 #![feature(generic_const_exprs)]
5
6 pub trait Foo {
7     const SIZE: usize;
8
9     fn to_bytes(&self) -> [u8; Self::SIZE];
10 }
11
12 pub fn bar<G: Foo>(a: &G) -> u8
13 where
14     [(); G::SIZE]: Sized,
15 {
16     deeper_bar(a)
17 }
18
19 fn deeper_bar<G: Foo>(a: &G) -> u8
20 where
21     [(); G::SIZE]: Sized,
22 {
23     a.to_bytes()[0]
24 }
25
26 fn main() {}