summaryrefslogtreecommitdiffstats
path: root/src/test/ui/const-generics/issues/issue-87470.rs
blob: d60181a418a157bcd59511b3d9fed427dee9ab0a (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
// build-pass

#![feature(generic_const_exprs)]
#![allow(incomplete_features)]

pub trait TraitWithConst {
    const SOME_CONST: usize;
}

pub trait OtherTrait: TraitWithConst {
    fn some_fn(self) -> [u8 ; <Self as TraitWithConst>::SOME_CONST];
}

impl TraitWithConst for f32 {
    const SOME_CONST: usize = 32;
}

impl OtherTrait for f32 {
    fn some_fn(self) -> [u8 ; <Self as TraitWithConst>::SOME_CONST] {
        [0; 32]
    }
}

fn main() {}