improves duplicate lang item test
This commit is contained in:
parent
62075593a8
commit
27077b94c2
3 changed files with 23 additions and 21 deletions
|
|
@ -1,18 +0,0 @@
|
|||
//@ normalize-stderr: "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
|
||||
// note-pattern: first defined in crate `std`.
|
||||
|
||||
// Test for issue #31788 and E0152
|
||||
|
||||
#![feature(lang_items)]
|
||||
|
||||
extern crate core;
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[lang = "panic_impl"]
|
||||
fn panic_impl(info: &PanicInfo) -> ! {
|
||||
//~^ ERROR: found duplicate lang item `panic_impl`
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
20
tests/ui/error-codes/E0152-duplicate-lang-items.rs
Normal file
20
tests/ui/error-codes/E0152-duplicate-lang-items.rs
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
//! Validates the correct printing of E0152 in the case of duplicate "lang_item" function
|
||||
//! definitions.
|
||||
//!
|
||||
//! Issue: <https://github.com/rust-lang/rust/issues/31788>
|
||||
|
||||
//@ error-pattern: first defined in crate `std`
|
||||
//@ normalize-stderr: "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
|
||||
#![feature(lang_items)]
|
||||
|
||||
extern crate core;
|
||||
|
||||
use core::panic::PanicInfo;
|
||||
|
||||
#[lang = "panic_impl"]
|
||||
fn panic_impl(info: &PanicInfo) -> ! {
|
||||
//~^ ERROR: found duplicate lang item `panic_impl`
|
||||
loop {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
error[E0152]: found duplicate lang item `panic_impl`
|
||||
--> $DIR/duplicate_entry_error.rs:13:1
|
||||
--> $DIR/E0152-duplicate-lang-items.rs:15:1
|
||||
|
|
||||
LL | / fn panic_impl(info: &PanicInfo) -> ! {
|
||||
LL | |
|
||||
|
|
@ -7,9 +7,9 @@ LL | | loop {}
|
|||
LL | | }
|
||||
| |_^
|
||||
|
|
||||
= note: the lang item is first defined in crate `std` (which `duplicate_entry_error` depends on)
|
||||
= note: the lang item is first defined in crate `std` (which `E0152_duplicate_lang_items` depends on)
|
||||
= note: first definition in `std` loaded from SYSROOT/libstd-*.rlib
|
||||
= note: second definition in the local crate (`duplicate_entry_error`)
|
||||
= note: second definition in the local crate (`E0152_duplicate_lang_items`)
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue