about summary refs log tree commit diff
path: root/src/test/ui/panic-handler
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-01 20:35:46 -0700
committerGitHub <noreply@github.com>2020-07-01 20:35:46 -0700
commit6b57050b17de7055ca2345867ee4eb8c5b5f1fa9 (patch)
treebe994523e256b95c6e6b8bf7519ddbd7706a54ef /src/test/ui/panic-handler
parent8ed5c0d37a79d22b919c969141f3453ade407ca1 (diff)
parent1b3ef660261c880783db0154b89c09a1c4608845 (diff)
downloadrust-6b57050b17de7055ca2345867ee4eb8c5b5f1fa9.tar.gz
rust-6b57050b17de7055ca2345867ee4eb8c5b5f1fa9.zip
Rollup merge of #73449 - ehuss:duplicate-lang-item, r=matthewjasper
Provide more information on duplicate lang item error.

This gives some notes on the location of the files where the lang items were loaded from. Some duplicate lang item errors can be a little confusing, and this might help in diagnosing what has happened.

Here's an example when hitting a bug with Cargo's build-std:

```
error: duplicate lang item in crate `core` (which `rustc_std_workspace_core` depends on): `try`.
  |
  = note: the lang item is first defined in crate `core` (which `z10` depends on)
  = note: first definition in `core` loaded from /Users/eric/Proj/rust/cargo/scratch/z10/target/target/debug/deps/libcore-a764da499c7385f4.rmeta
  = note: second definition in `core` loaded from /Users/eric/Proj/rust/cargo/scratch/z10/target/target/debug/deps/libcore-5b082675aea34986.rmeta
```
Diffstat (limited to 'src/test/ui/panic-handler')
-rw-r--r--src/test/ui/panic-handler/panic-handler-std.rs1
-rw-r--r--src/test/ui/panic-handler/panic-handler-std.stderr6
2 files changed, 5 insertions, 2 deletions
diff --git a/src/test/ui/panic-handler/panic-handler-std.rs b/src/test/ui/panic-handler/panic-handler-std.rs
index 0acc2722cb2..6183c886cfa 100644
--- a/src/test/ui/panic-handler/panic-handler-std.rs
+++ b/src/test/ui/panic-handler/panic-handler-std.rs
@@ -1,3 +1,4 @@
+// normalize-stderr-test "loaded from .*libstd-.*.rlib" -> "loaded from SYSROOT/libstd-*.rlib"
 // error-pattern: found duplicate lang item `panic_impl`
 
 
diff --git a/src/test/ui/panic-handler/panic-handler-std.stderr b/src/test/ui/panic-handler/panic-handler-std.stderr
index f71c28e5aa6..bb656089bca 100644
--- a/src/test/ui/panic-handler/panic-handler-std.stderr
+++ b/src/test/ui/panic-handler/panic-handler-std.stderr
@@ -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 the local crate (`panic_handler_std`)
 
 error: argument should be `&PanicInfo`
-  --> $DIR/panic-handler-std.rs:7:16
+  --> $DIR/panic-handler-std.rs:8:16
    |
 LL | fn panic(info: PanicInfo) -> ! {
    |                ^^^^^^^^^