Add ICE test for bad Add::add impl item type

This commit is contained in:
Michael Goulet 2023-02-16 20:58:48 +00:00
parent ff9c5db03c
commit 2a700d47f5
2 changed files with 29 additions and 0 deletions

View File

@ -0,0 +1,18 @@
#![feature(no_core)]
#![feature(lang_items)]
#![no_core]
#[lang = "sized"]
trait Sized {}
#[lang = "add"]
trait Add<T> {
const add: u32 = 1u32;
}
impl Add<u32> for u32 {}
fn main() {
1u32 + 1u32;
//~^ ERROR cannot add `u32` to `u32`
}

View File

@ -0,0 +1,11 @@
error[E0369]: cannot add `u32` to `u32`
--> $DIR/bad-add-impl.rs:16:10
|
LL | 1u32 + 1u32;
| ---- ^ ---- u32
| |
| u32
error: aborting due to previous error
For more information about this error, try `rustc --explain E0369`.