This commit is contained in:
Deadbeef 2022-01-11 23:52:24 +08:00
parent 7fd6ddfba2
commit bf5130b502
No known key found for this signature in database
GPG key ID: 6D017A96D8E6C2F9
2 changed files with 26 additions and 0 deletions

View file

@ -0,0 +1,17 @@
#![feature(const_fn_trait_bound)]
#![feature(const_trait_impl)]
pub trait Tr {
#[default_method_body_is_const]
fn a(&self) {}
#[default_method_body_is_const]
fn b(&self) {
().a()
//~^ ERROR calls in constant functions are limited
}
}
impl Tr for () {}
fn main() {}

View file

@ -0,0 +1,9 @@
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
--> $DIR/default-method-body-is-const-same-trait-ck.rs:10:9
|
LL | ().a()
| ^^^^^^
error: aborting due to previous error
For more information about this error, try `rustc --explain E0015`.