2020-11-22 09:37:37 +00:00
|
|
|
#![crate_type = "lib"]
|
2021-08-27 18:04:57 +02:00
|
|
|
#![feature(generic_const_exprs)]
|
2020-11-22 09:37:37 +00:00
|
|
|
#![allow(incomplete_features)]
|
2023-05-18 14:57:45 +03:00
|
|
|
|
2020-11-22 09:37:37 +00:00
|
|
|
pub struct Const<const U: u8>;
|
|
|
|
|
|
|
|
pub trait Trait {
|
|
|
|
type AssocTy;
|
|
|
|
fn assoc_fn() -> Self::AssocTy;
|
|
|
|
}
|
|
|
|
|
2021-11-04 16:31:18 +00:00
|
|
|
impl<const U: u8> Trait for Const<U> // OK, trait impl predicates
|
2020-11-22 09:37:37 +00:00
|
|
|
where
|
|
|
|
Const<{ my_const_fn(U) }>: ,
|
|
|
|
{
|
|
|
|
type AssocTy = Const<{ my_const_fn(U) }>;
|
|
|
|
//~^ ERROR private type
|
|
|
|
fn assoc_fn() -> Self::AssocTy {
|
|
|
|
Const
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
const fn my_const_fn(val: u8) -> u8 {
|
|
|
|
// body of this function doesn't matter
|
|
|
|
val
|
|
|
|
}
|