Skip to content

Commit c54f43a

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

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

src/librustc/diagnostics.rs

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,26 @@ use Method::*;
217217
enum Method { GET, POST }
218218
"##,
219219

220+
E0267: r##"
221+
This error indicates the use of loop keyword (break or continue) inside a
222+
closure but outside of any loop. Break and continue can be used as normal
223+
inside closures as long as they are also contained within a loop. To halt the
224+
execution of a closure you should instead use a return statement.
225+
"##,
226+
227+
E0268: r##"
228+
This error indicates the use of loop keyword (break or continue) outside of a
229+
loop. Without a loop to break out of or continue in, no sensible action can be
230+
taken.
231+
"##,
232+
233+
E0296: r##"
234+
This error indicates that the given recursion limit could not be parsed. Ensure
235+
that the value provided is a positive integer between quotes, like so:
236+
237+
#![recursion_limit="1000"]
238+
"##,
239+
220240
E0297: r##"
221241
Patterns used to bind names must be irrefutable. That is, they must guarantee
222242
that a name will be extracted in all cases. Instead of pattern matching the
@@ -277,21 +297,23 @@ In certain cases it is possible for sub-bindings to violate memory safety.
277297
Updates to the borrow checker in a future version of Rust may remove this
278298
restriction, but for now patterns must be rewritten without sub-bindings.
279299
280-
// Code like this...
281-
match Some(5) {
282-
ref op_num @ Some(num) => ...
300+
// Before.
301+
match Some("hi".to_string()) {
302+
ref op_string_ref @ Some(ref s) => ...
283303
None => ...
284304
}
285305
286-
// ... should be updated to code like this.
287-
match Some(5) {
288-
Some(num) => {
289-
let op_num = &Some(num);
306+
// After.
307+
match Some("hi".to_string()) {
308+
Some(ref s) => {
309+
let op_string_ref = &Some(&s);
290310
...
291311
}
292312
None => ...
293313
}
294314
315+
The `op_string_ref` binding has type &Option<&String> in both cases.
316+
295317
See also https://github.com/rust-lang/rust/issues/14587
296318
"##,
297319

@@ -338,8 +360,6 @@ register_diagnostics! {
338360
E0264, // unknown external lang item
339361
E0265, // recursive constant
340362
E0266, // expected item
341-
E0267, // thing inside of a closure
342-
E0268, // thing outside of a loop
343363
E0269, // not all control paths return a value
344364
E0270, // computation may converge in a function marked as diverging
345365
E0271, // type mismatch resolving
@@ -357,7 +377,6 @@ register_diagnostics! {
357377
E0283, // cannot resolve type
358378
E0284, // cannot resolve type
359379
E0285, // overflow evaluation builtin bounds
360-
E0296, // malformed recursion limit attribute
361380
E0298, // mismatched types between arms
362381
E0299, // mismatched types between arms
363382
E0300, // unexpanded macro

0 commit comments

Comments
 (0)