2021-06-23 18:37:26 +08:00
|
|
|
#![feature(const_trait_impl)]
|
|
|
|
|
|
|
|
|
|
trait Tr {
|
|
|
|
|
fn req(&self);
|
|
|
|
|
|
|
|
|
|
fn prov(&self) {
|
|
|
|
|
println!("lul");
|
|
|
|
|
self.req();
|
|
|
|
|
}
|
2021-07-04 12:24:20 +08:00
|
|
|
|
|
|
|
|
#[default_method_body_is_const]
|
|
|
|
|
fn default() {}
|
2021-06-23 18:37:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
struct S;
|
|
|
|
|
|
|
|
|
|
impl const Tr for S {
|
|
|
|
|
fn req(&self) {}
|
2021-07-04 12:24:20 +08:00
|
|
|
} //~^^ ERROR const trait implementations may not use non-const default functions
|
|
|
|
|
|
|
|
|
|
impl const Tr for u16 {
|
|
|
|
|
fn prov(&self) {}
|
|
|
|
|
fn default() {}
|
|
|
|
|
} //~^^^ ERROR not all trait items implemented
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
impl const Tr for u32 {
|
|
|
|
|
fn req(&self) {}
|
|
|
|
|
fn default() {}
|
|
|
|
|
} //~^^^ ERROR const trait implementations may not use non-const default functions
|
2021-06-23 18:37:26 +08:00
|
|
|
|
|
|
|
|
fn main() {}
|