2021-07-06 00:05:24 -05:00
|
|
|
#![feature(const_trait_impl)]
|
|
|
|
|
2022-03-16 04:49:54 -05:00
|
|
|
#[const_trait]
|
2021-07-06 00:05:24 -05:00
|
|
|
trait ConstDefaultFn: Sized {
|
|
|
|
fn b(self);
|
|
|
|
|
|
|
|
fn a(self) {
|
|
|
|
self.b();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct NonConstImpl;
|
|
|
|
struct ConstImpl;
|
|
|
|
|
|
|
|
impl ConstDefaultFn for NonConstImpl {
|
|
|
|
fn b(self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl const ConstDefaultFn for ConstImpl {
|
|
|
|
fn b(self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
const fn test() {
|
|
|
|
NonConstImpl.a();
|
2022-01-28 04:57:29 -06:00
|
|
|
//~^ ERROR the trait bound
|
2021-07-06 00:05:24 -05:00
|
|
|
ConstImpl.a();
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|