Skip to content

Commit 2a700d4

Browse files
Add ICE test for bad Add::add impl item type
1 parent ff9c5db commit 2a700d4

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

tests/ui/lang-items/bad-add-impl.rs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![feature(no_core)]
2+
#![feature(lang_items)]
3+
#![no_core]
4+
5+
#[lang = "sized"]
6+
trait Sized {}
7+
8+
#[lang = "add"]
9+
trait Add<T> {
10+
const add: u32 = 1u32;
11+
}
12+
13+
impl Add<u32> for u32 {}
14+
15+
fn main() {
16+
1u32 + 1u32;
17+
//~^ ERROR cannot add `u32` to `u32`
18+
}
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
error[E0369]: cannot add `u32` to `u32`
2+
--> $DIR/bad-add-impl.rs:16:10
3+
|
4+
LL | 1u32 + 1u32;
5+
| ---- ^ ---- u32
6+
| |
7+
| u32
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)