2024-10-02 19:42:06 +08:00
|
|
|
//@ compile-flags: -Znext-solver
|
2024-10-30 18:03:44 +00:00
|
|
|
#![feature(const_trait_impl)]
|
2021-07-06 13:05:24 +08:00
|
|
|
|
2022-03-16 20:49:54 +11:00
|
|
|
#[const_trait]
|
2021-07-06 13:05:24 +08: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();
|
2025-03-11 12:08:45 +00:00
|
|
|
//~^ ERROR the trait bound `NonConstImpl: [const] ConstDefaultFn` is not satisfied
|
2021-07-06 13:05:24 +08:00
|
|
|
ConstImpl.a();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() {}
|