Skip to content

Commit

Permalink
Add test for duplicate lang items
Browse files Browse the repository at this point in the history
  • Loading branch information
Noratrieb committed Jan 29, 2024
1 parent a360ecd commit ead7a4b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/ui/lang-items/duplicate.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#![feature(lang_items)]

#[lang = "sized"]
trait Sized {}
//~^ ERROR: duplicate lang item

#[lang = "tuple_trait"]
pub trait Tuple {}
// no error
13 changes: 13 additions & 0 deletions tests/ui/lang-items/duplicate.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
error[E0152]: found duplicate lang item `sized`
--> $DIR/duplicate.rs:4: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 $BUILD_DIR/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-6cf4a3b928cf7834.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`.

0 comments on commit ead7a4b

Please sign in to comment.