Skip to content

Commit 98a1663

Browse files
committed
documented/fixed error-codes/E0152-duplicate-lang-items.rs
1 parent beeaa8e commit 98a1663

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

tests/ui/duplicate_entry_error.stderr

Lines changed: 0 additions & 16 deletions
This file was deleted.

tests/ui/error-codes/E0152-duplicate-lang-items.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
//@ normalize-stderr: "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
2-
// note-pattern: first defined in crate `std`.
3-
4-
// Test for issue #31788 and E0152
1+
//! Validates the correct printing of E0152 in the case of duplicate "lang_item" function
2+
//! definitions.
3+
//!
4+
//! Error: E0152
5+
//! Issue: <https://github.com/rust-lang/rust/issues/31788>
56
7+
//@ error-pattern: first defined in crate `std`
68
#![feature(lang_items)]
79

810
extern crate core;
@@ -11,7 +13,7 @@ use core::panic::PanicInfo;
1113

1214
#[lang = "panic_impl"]
1315
fn panic_impl(info: &PanicInfo) -> ! {
14-
//~^ ERROR: found duplicate lang item `panic_impl`
16+
//~^ ERROR: found duplicate lang item `panic_impl`
1517
loop {}
1618
}
1719

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
error[E0152]: found duplicate lang item `panic_impl`
2+
--> $DIR/E0152-duplicate-lang-items.rs:14:1
3+
|
4+
LL | / fn panic_impl(info: &PanicInfo) -> ! {
5+
LL | |
6+
LL | | loop {}
7+
LL | | }
8+
| |_^
9+
|
10+
= note: the lang item is first defined in crate `std` (which `E0152_duplicate_lang_items` depends on)
11+
= note: first definition in `std` loaded from $BUILD_DIR/x86_64-unknown-linux-gnu/stage1/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-df4a2d41d5905242.rlib
12+
= note: second definition in the local crate (`E0152_duplicate_lang_items`)
13+
14+
error: aborting due to 1 previous error
15+
16+
For more information about this error, try `rustc --explain E0152`.

0 commit comments

Comments
 (0)