]> git.proxmox.com Git - rustc.git/blob - tests/ui/const-generics/generic_const_exprs/eval-privacy.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / 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> // OK, trait impl predicates
13 where
14 Const<{ my_const_fn(U) }>: ,
15 {
16 type AssocTy = Const<{ my_const_fn(U) }>;
17 //~^ ERROR private type
18 fn assoc_fn() -> Self::AssocTy {
19 Const
20 }
21 }
22
23 const fn my_const_fn(val: u8) -> u8 {
24 // body of this function doesn't matter
25 val
26 }