Skip to content

Commit c514dc6

Browse files
committed
Update/add messages for E0{267,268,296,303}.
1 parent e3f5ad6 commit c514dc6

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

src/librustc/diagnostics.rs

+29-10
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,26 @@ loop {
151151
}
152152
"##,
153153

154+
E0267: r##"
155+
This error indicates the use of loop keyword (break or continue) inside a
156+
closure but outside of any loop. Break and continue can be used as normal
157+
inside closures as long as they are also contained within a loop. To halt the
158+
execution of a closure you should instead use a return statement.
159+
"##,
160+
161+
E0268: r##"
162+
This error indicates the use of loop keyword (break or continue) outside of a
163+
loop. Without a loop to break out of or continue in, no sensible action can be
164+
taken.
165+
"##,
166+
167+
E0296: r##"
168+
This error indicates that the given recursion limit could not be parsed. Ensure
169+
that the value provided is a positive integer between quotes, like so:
170+
171+
#![recursion_limit="1000"]
172+
"##,
173+
154174
E0297: r##"
155175
Patterns used to bind names must be irrefutable. That is, they must guarantee
156176
that a name will be extracted in all cases. Instead of pattern matching the
@@ -211,21 +231,23 @@ In certain cases it is possible for sub-bindings to violate memory safety.
211231
Updates to the borrow checker in a future version of Rust may remove this
212232
restriction, but for now patterns must be rewritten without sub-bindings.
213233
214-
// Code like this...
215-
match Some(5) {
216-
ref op_num @ Some(num) => ...
234+
// Before.
235+
match Some("hi".to_string()) {
236+
ref op_string_ref @ Some(ref s) => ...
217237
None => ...
218238
}
219239
220-
// ... should be updated to code like this.
221-
match Some(5) {
222-
Some(num) => {
223-
let op_num = &Some(num);
240+
// After.
241+
match Some("hi".to_string()) {
242+
Some(ref s) => {
243+
let op_string_ref = &Some(&s);
224244
...
225245
}
226246
None => ...
227247
}
228248
249+
The `op_string_ref` binding has type &Option<&String> in both cases.
250+
229251
See also https://github.com/rust-lang/rust/issues/14587
230252
"##
231253

@@ -266,8 +288,6 @@ register_diagnostics! {
266288
E0264, // unknown external lang item
267289
E0265, // recursive constant
268290
E0266, // expected item
269-
E0267, // thing inside of a closure
270-
E0268, // thing outside of a loop
271291
E0269, // not all control paths return a value
272292
E0270, // computation may converge in a function marked as diverging
273293
E0271, // type mismatch resolving
@@ -285,7 +305,6 @@ register_diagnostics! {
285305
E0283, // cannot resolve type
286306
E0284, // cannot resolve type
287307
E0285, // overflow evaluation builtin bounds
288-
E0296, // malformed recursion limit attribute
289308
E0298, // mismatched types between arms
290309
E0299, // mismatched types between arms
291310
E0300, // unexpanded macro

0 commit comments

Comments
 (0)