Skip to content

Commit bf5130b

Browse files
committed
Add test
1 parent 7fd6ddf commit bf5130b

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#![feature(const_fn_trait_bound)]
2+
#![feature(const_trait_impl)]
3+
4+
pub trait Tr {
5+
#[default_method_body_is_const]
6+
fn a(&self) {}
7+
8+
#[default_method_body_is_const]
9+
fn b(&self) {
10+
().a()
11+
//~^ ERROR calls in constant functions are limited
12+
}
13+
}
14+
15+
impl Tr for () {}
16+
17+
fn main() {}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants
2+
--> $DIR/default-method-body-is-const-same-trait-ck.rs:10:9
3+
|
4+
LL | ().a()
5+
| ^^^^^^
6+
7+
error: aborting due to previous error
8+
9+
For more information about this error, try `rustc --explain E0015`.

0 commit comments

Comments
 (0)