From 1b984b501d176bf583ad708a348a33c7d3daa279 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Mon, 7 Dec 2015 15:55:51 +0100 Subject: [PATCH] Add E0264 error explanation --- src/librustc/diagnostics.rs | 26 +++++++++++++++++++++++++- src/librustc/middle/weak_lang_items.rs | 4 ++-- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 3f4696cdfd9..b09dbe161f4 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -1037,6 +1037,31 @@ fn foo<'a, 'b, 'a>(x: &'a str, y: &'b str) { } ``` "##, +E0264: r##" +An unknown external lang item was used. Erroneous code example: + +``` +#![feature(lang_items)] + +extern "C" { + #[lang = "cake"] // error: unknown external lang item: `cake` + fn cake(); +} +``` + +A list of available external lang items is available in +`src/librustc/middle/weak_lang_items.rs`. Example: + +``` +#![feature(lang_items)] + +extern "C" { + #[lang = "panic_fmt"] // ok! + fn cake(); +} +``` +"##, + E0265: r##" This error indicates that a static or constant references itself. All statics and constants need to resolve to a value in an acyclic manner. @@ -2200,7 +2225,6 @@ impl Foo { // E0134, // E0135, E0229, // associated type bindings are not allowed here - E0264, // unknown external lang item E0278, // requirement is not satisfied E0279, // requirement is not satisfied E0280, // requirement is not satisfied diff --git a/src/librustc/middle/weak_lang_items.rs b/src/librustc/middle/weak_lang_items.rs index 78cdc99f047..6059d7ee74e 100644 --- a/src/librustc/middle/weak_lang_items.rs +++ b/src/librustc/middle/weak_lang_items.rs @@ -102,8 +102,8 @@ fn register(&mut self, name: &str, span: Span) { } } else)* { span_err!(self.sess, span, E0264, - "unknown external lang item: `{}`", - name); + "unknown external lang item: `{}`", + name); } } }