granite-rust/tests/ui/traits/const-traits/const-default-method-bodies.rs
Michael Goulet e91267f3f0 Move tests
2024-10-22 00:03:09 +00:00

31 lines
534 B
Rust

//@ compile-flags: -Znext-solver
#![allow(incomplete_features)]
#![feature(const_trait_impl, effects)]
#[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 `NonConstImpl: ~const ConstDefaultFn` is not satisfied
ConstImpl.a();
}
fn main() {}