diff options
| author | Michael Goulet <michael@errs.io> | 2023-02-16 20:58:48 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-02-16 20:58:48 +0000 |
| commit | 2a700d47f592a52ebc32ae41b67cd5da756a17d9 (patch) | |
| tree | 441686e84290b498892f5996a73936a78816d1ba | |
| parent | ff9c5db03cc4fad005b9e3651b42a6945a0d9f36 (diff) | |
| download | rust-2a700d47f592a52ebc32ae41b67cd5da756a17d9.tar.gz rust-2a700d47f592a52ebc32ae41b67cd5da756a17d9.zip | |
Add ICE test for bad Add::add impl item type
| -rw-r--r-- | tests/ui/lang-items/bad-add-impl.rs | 18 | ||||
| -rw-r--r-- | tests/ui/lang-items/bad-add-impl.stderr | 11 |
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/lang-items/bad-add-impl.rs b/tests/ui/lang-items/bad-add-impl.rs new file mode 100644 index 00000000000..0c44edbe51a --- /dev/null +++ b/tests/ui/lang-items/bad-add-impl.rs @@ -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` +} diff --git a/tests/ui/lang-items/bad-add-impl.stderr b/tests/ui/lang-items/bad-add-impl.stderr new file mode 100644 index 00000000000..3143729f99b --- /dev/null +++ b/tests/ui/lang-items/bad-add-impl.stderr @@ -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`. |
