Skip to content

Commit ead7a4b

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

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

tests/ui/lang-items/duplicate.rs

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#![feature(lang_items)]
2+
3+
#[lang = "sized"]
4+
trait Sized {}
5+
//~^ ERROR: duplicate lang item
6+
7+
#[lang = "tuple_trait"]
8+
pub trait Tuple {}
9+
// 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:4: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 $BUILD_DIR/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-6cf4a3b928cf7834.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)