Skip to content

Commit 2a1dc1e

Browse files
authored
Add test
Add test for incompleately implemented add trait, see issue rust-lang#31076
1 parent 56ac2c4 commit 2a1dc1e

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/test/ui/issues/issue-31076.rs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![feature(no_core, lang_items)]
2+
#![no_core]
3+
4+
#[lang="sized"]
5+
trait Sized {}
6+
7+
#[lang="add"]
8+
trait Add<T> {}
9+
10+
impl Add<i32> for i32 {}
11+
12+
fn main() {
13+
let x = 5 + 6;
14+
//~^ ERROR binary operation `+` cannot be applied to type `{integer}`
15+
}

src/test/ui/issues/issue-31076.stderr

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0369]: binary operation `+` cannot be applied to type `{integer}`
2+
--> $DIR/typeck-issue-31076-correct-trait-impl.rs:13:13
3+
|
4+
LL | let x = 5 + 6;
5+
| ^^^^^
6+
|
7+
= note: an implementation of `std::ops::Add` might be missing for `{integer}`
8+
9+
error: aborting due to previous error
10+
11+
For more information about this error, try `rustc --explain E0369`.

0 commit comments

Comments
 (0)