From 4fa84830f8a91a2a8db988afec96b416ae2654c0 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Fri, 27 May 2016 21:57:06 +0200 Subject: [PATCH] improve E0152 error explanation --- src/librustc/diagnostics.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 7c350987aa1e..a410a5949bdc 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -525,6 +525,17 @@ call to `mem::forget(v)` in case you want to avoid destructors being called. "##, E0152: r##" +A lang item was redefined. + +Erroneous code example: + +```compile_fail +#![feature(lang_items)] + +#[lang = "panic_fmt"] +struct Foo; // error: duplicate lang item found: `panic_fmt` +``` + Lang items are already implemented in the standard library. Unless you are writing a free-standing application (e.g. a kernel), you do not need to provide them yourself.