rust/tests/ui/rfc-2632-const-trait-impl/const-default-method-bodies.rs
2023-01-11 09:32:08 +00:00

30 lines
406 B
Rust

#![feature(const_trait_impl)]
#[const_trait]
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();
//~^ ERROR the trait bound
ConstImpl.a();
}
fn main() {}