Provide more information on duplicate lang item error.

This commit is contained in:
Eric Huss 2020-06-17 11:05:30 -07:00
parent 665190b346
commit c225e5c5cb
10 changed files with 49 additions and 4 deletions

View file

@ -1,3 +1,4 @@
// normalize-stderr-test "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
// note-pattern: first defined in crate `std`.
// Test for issue #31788 and E0152

View file

@ -1,5 +1,5 @@
error[E0152]: found duplicate lang item `panic_impl`
--> $DIR/duplicate_entry_error.rs:10:1
--> $DIR/duplicate_entry_error.rs:11:1
|
LL | / fn panic_impl(info: &PanicInfo) -> ! {
LL | |
@ -8,6 +8,8 @@ LL | | }
| |_^
|
= note: the lang item is first defined in crate `std` (which `duplicate_entry_error` depends on)
= note: first definition in `std` loaded from SYSROOT/libstd-*.rlib
= note: second definition in `duplicate_entry_error` loaded from the local crate
error: aborting due to previous error

View file

@ -1,3 +1,4 @@
// normalize-stderr-test "loaded from .*liballoc-.*.rlib" -> "loaded from SYSROOT/liballoc-*.rlib"
#![feature(lang_items)]
#[lang = "owned_box"]

View file

@ -1,10 +1,12 @@
error[E0152]: found duplicate lang item `owned_box`
--> $DIR/E0152.rs:4:1
--> $DIR/E0152.rs:5:1
|
LL | struct Foo;
| ^^^^^^^^^^^
|
= note: the lang item is first defined in crate `alloc` (which `std` depends on)
= note: first definition in `alloc` loaded from SYSROOT/liballoc-*.rlib
= note: second definition in `E0152` loaded from the local crate
error: aborting due to previous error

View file

@ -1,3 +1,4 @@
// normalize-stderr-test "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
// error-pattern: found duplicate lang item `panic_impl`

View file

@ -1,5 +1,5 @@
error[E0152]: found duplicate lang item `panic_impl`
--> $DIR/panic-handler-std.rs:7:1
--> $DIR/panic-handler-std.rs:8:1
|
LL | / fn panic(info: PanicInfo) -> ! {
LL | | loop {}
@ -7,9 +7,11 @@ LL | | }
| |_^
|
= note: the lang item is first defined in crate `std` (which `panic_handler_std` depends on)
= note: first definition in `std` loaded from SYSROOT/libstd-*.rlib
= note: second definition in `panic_handler_std` loaded from the local crate
error: argument should be `&PanicInfo`
--> $DIR/panic-handler-std.rs:7:16
--> $DIR/panic-handler-std.rs:8:16
|
LL | fn panic(info: PanicInfo) -> ! {
| ^^^^^^^^^