diff options
| author | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2024-01-29 20:10:01 +0100 |
|---|---|---|
| committer | Nilstrieb <48135649+Nilstrieb@users.noreply.github.com> | 2024-01-29 20:37:06 +0100 |
| commit | 1f89e900738b30c15894e57d7bdb1c2dbc089976 (patch) | |
| tree | a99baf7ff716599c3e8d881480235da160afc6b9 | |
| parent | a360ecd64be275a4ecf2693dbfa058c9b48aa5d6 (diff) | |
| download | rust-1f89e900738b30c15894e57d7bdb1c2dbc089976.tar.gz rust-1f89e900738b30c15894e57d7bdb1c2dbc089976.zip | |
Add test for duplicate lang items
| -rw-r--r-- | tests/ui/lang-items/duplicate.rs | 10 | ||||
| -rw-r--r-- | tests/ui/lang-items/duplicate.stderr | 13 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/ui/lang-items/duplicate.rs b/tests/ui/lang-items/duplicate.rs new file mode 100644 index 00000000000..f88d2354414 --- /dev/null +++ b/tests/ui/lang-items/duplicate.rs @@ -0,0 +1,10 @@ +// normalize-stderr-test "loaded from .*libcore-.*.rlib" -> "loaded from SYSROOT/libcore-*.rlib" +#![feature(lang_items)] + +#[lang = "sized"] +trait Sized {} +//~^ ERROR: duplicate lang item + +#[lang = "tuple_trait"] +pub trait Tuple {} +// no error diff --git a/tests/ui/lang-items/duplicate.stderr b/tests/ui/lang-items/duplicate.stderr new file mode 100644 index 00000000000..aaa8f5e605a --- /dev/null +++ b/tests/ui/lang-items/duplicate.stderr @@ -0,0 +1,13 @@ +error[E0152]: found duplicate lang item `sized` + --> $DIR/duplicate.rs:5:1 + | +LL | trait Sized {} + | ^^^^^^^^^^^^^^ + | + = note: the lang item is first defined in crate `core` (which `std` depends on) + = note: first definition in `core` loaded from SYSROOT/libcore-*.rlib + = note: second definition in the local crate (`duplicate`) + +error: aborting due to 1 previous error + +For more information about this error, try `rustc --explain E0152`. |
