Skip to content

Commit 1f89e90

Browse files
committed
Add test for duplicate lang items
1 parent a360ecd commit 1f89e90

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/ui/lang-items/duplicate.rs

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// normalize-stderr-test "loaded from .*libcore-.*.rlib" -> "loaded from SYSROOT/libcore-*.rlib"
2+
#![feature(lang_items)]
3+
4+
#[lang = "sized"]
5+
trait Sized {}
6+
//~^ ERROR: duplicate lang item
7+
8+
#[lang = "tuple_trait"]
9+
pub trait Tuple {}
10+
// no error

tests/ui/lang-items/duplicate.stderr

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
error[E0152]: found duplicate lang item `sized`
2+
--> $DIR/duplicate.rs:5:1
3+
|
4+
LL | trait Sized {}
5+
| ^^^^^^^^^^^^^^
6+
|
7+
= note: the lang item is first defined in crate `core` (which `std` depends on)
8+
= note: first definition in `core` loaded from SYSROOT/libcore-*.rlib
9+
= note: second definition in the local crate (`duplicate`)
10+
11+
error: aborting due to 1 previous error
12+
13+
For more information about this error, try `rustc --explain E0152`.

0 commit comments

Comments
 (0)