]> git.lizzy.rs Git - rust.git/blob - src/test/ui/const-generics/generic_const_exprs/eval-privacy.rs
Move generic error message to separate branches
[rust.git] / src / test / ui / const-generics / generic_const_exprs / eval-privacy.rs
1 #![crate_type = "lib"]
2 #![feature(generic_const_exprs)]
3 #![allow(incomplete_features)]
4
5 pub struct Const<const U: u8>;
6
7 pub trait Trait {
8     type AssocTy;
9     fn assoc_fn() -> Self::AssocTy;
10 }
11
12 impl<const U: u8> Trait for Const<U>
13 //~^ WARN private type
14 //~| WARN this was previously
15 //~| WARN private type
16 //~| WARN this was previously
17
18 where
19     Const<{ my_const_fn(U) }>: ,
20 {
21     type AssocTy = Const<{ my_const_fn(U) }>;
22     //~^ ERROR private type
23     fn assoc_fn() -> Self::AssocTy {
24         Const
25     }
26 }
27
28 const fn my_const_fn(val: u8) -> u8 {
29     // body of this function doesn't matter
30     val
31 }