From 8933253f2b1e8cd164b1290e2a41135c31c4b2c6 Mon Sep 17 00:00:00 2001 From: Brendan Graetz Date: Tue, 28 Apr 2015 19:53:10 +1000 Subject: [PATCH 1/2] =BG= Add detailed error message for E0265 This error indicates that a constant references itself. All constants need to resolve to a value in an acyclic manner. For example, neither of the following can be sensibly compiled: ``` const X: u32 = X; ``` ``` const X: u32 = Y; const Y: u32 = X; ``` --- src/librustc/diagnostics.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 182405a640dbc..5b3349aeaa171 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -336,6 +336,22 @@ enum Method { GET, POST } ``` "##, +E0265: r##" +This error indicates that a constant references itself. +All constants need to resolve to a value in an acyclic manner. + +For example, neither of the following can be sensibly compiled: + +``` +const X: u32 = X; +``` + +``` +const X: u32 = Y; +const Y: u32 = X; +``` +"##, + E0267: r##" This error indicates the use of loop keyword (break or continue) inside a closure but outside of any loop. Break and continue can be used as normal @@ -482,7 +498,6 @@ register_diagnostics! { E0262, // illegal lifetime parameter name E0263, // lifetime name declared twice in same scope E0264, // unknown external lang item - E0265, // recursive constant E0266, // expected item E0269, // not all control paths return a value E0270, // computation may converge in a function marked as diverging From 1335be33e4587184069a7a50c813ce6420b81a5f Mon Sep 17 00:00:00 2001 From: Brendan Graetz Date: Tue, 28 Apr 2015 20:22:26 +1000 Subject: [PATCH 2/2] =BG= change definition to use 'statics' as well as 'constants' --- src/librustc/diagnostics.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/librustc/diagnostics.rs b/src/librustc/diagnostics.rs index 5b3349aeaa171..6b3920f46ee82 100644 --- a/src/librustc/diagnostics.rs +++ b/src/librustc/diagnostics.rs @@ -337,8 +337,8 @@ enum Method { GET, POST } "##, E0265: r##" -This error indicates that a constant references itself. -All constants need to resolve to a value in an acyclic manner. +This error indicates that a static or constant references itself. +All statics and constants need to resolve to a value in an acyclic manner. For example, neither of the following can be sensibly compiled: