summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/issues/issue-89146.rs
blob: e3540f46f1e81ef2d3a06419a1613d762efbfe8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// 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() {}