fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
5.1 KiB175 linesraw
1warning: denote infinite loops with `loop { ... }`
2  --> $DIR/loop-break-value.rs:26:5
3   |
4LL |     'while_loop: while true {
5   |     ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop`
6   |
7   = note: `#[warn(while_true)]` on by default
8
9error[E0571]: `break` with value from a `while` loop
10  --> $DIR/loop-break-value.rs:28:9
11   |
12LL |         break ();
13   |         ^^^^^^^^ can only break with a value inside `loop` or breakable block
14   |
15help: instead, use `break` on its own without a value inside this `while` loop
16   |
17LL |         break;
18   |         ^^^^^
19
20error[E0571]: `break` with value from a `while` loop
21  --> $DIR/loop-break-value.rs:30:13
22   |
23LL |             break 'while_loop 123;
24   |             ^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
25   |
26help: instead, use `break` on its own without a value inside this `while` loop
27   |
28LL |             break;
29   |             ^^^^^
30
31error[E0571]: `break` with value from a `while let` loop
32  --> $DIR/loop-break-value.rs:38:12
33   |
34LL |         if break () {
35   |            ^^^^^^^^ can only break with a value inside `loop` or breakable block
36   |
37help: instead, use `break` on its own without a value inside this `while let` loop
38   |
39LL |         if break {
40   |            ^^^^^
41
42error[E0571]: `break` with value from a `while let` loop
43  --> $DIR/loop-break-value.rs:43:9
44   |
45LL |         break None;
46   |         ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
47   |
48help: instead, use `break` on its own without a value inside this `while let` loop
49   |
50LL |         break;
51   |         ^^^^^
52
53error[E0571]: `break` with value from a `while let` loop
54  --> $DIR/loop-break-value.rs:49:13
55   |
56LL |             break 'while_let_loop "nope";
57   |             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
58   |
59help: instead, use `break` on its own without a value inside this `while let` loop
60   |
61LL |             break;
62   |             ^^^^^
63
64error[E0571]: `break` with value from a `for` loop
65  --> $DIR/loop-break-value.rs:56:9
66   |
67LL |         break ();
68   |         ^^^^^^^^ can only break with a value inside `loop` or breakable block
69   |
70help: instead, use `break` on its own without a value inside this `for` loop
71   |
72LL |         break;
73   |         ^^^^^
74
75error[E0571]: `break` with value from a `for` loop
76  --> $DIR/loop-break-value.rs:57:9
77   |
78LL |         break [()];
79   |         ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
80   |
81help: instead, use `break` on its own without a value inside this `for` loop
82   |
83LL |         break;
84   |         ^^^^^
85
86error[E0571]: `break` with value from a `for` loop
87  --> $DIR/loop-break-value.rs:64:13
88   |
89LL |             break 'for_loop Some(17);
90   |             ^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
91   |
92help: instead, use `break` on its own without a value inside this `for` loop
93   |
94LL |             break;
95   |             ^^^^^
96
97error[E0308]: mismatched types
98  --> $DIR/loop-break-value.rs:4:31
99   |
100LL |     let val: ! = loop { break break; };
101   |                               ^^^^^ expected !, found ()
102   |
103   = note: expected type `!`
104              found type `()`
105
106error[E0308]: mismatched types
107  --> $DIR/loop-break-value.rs:11:19
108   |
109LL |             break 123;
110   |                   ^^^ expected &str, found integer
111   |
112   = note: expected type `&str`
113              found type `{integer}`
114
115error[E0308]: mismatched types
116  --> $DIR/loop-break-value.rs:16:15
117   |
118LL |         break "asdf";
119   |               ^^^^^^ expected i32, found reference
120   |
121   = note: expected type `i32`
122              found type `&'static str`
123
124error[E0308]: mismatched types
125  --> $DIR/loop-break-value.rs:21:31
126   |
127LL |             break 'outer_loop "nope";
128   |                               ^^^^^^ expected i32, found reference
129   |
130   = note: expected type `i32`
131              found type `&'static str`
132
133error[E0308]: mismatched types
134  --> $DIR/loop-break-value.rs:73:26
135   |
136LL |                 break 'c 123;
137   |                          ^^^ expected (), found integer
138   |
139   = note: expected type `()`
140              found type `{integer}`
141
142error[E0308]: mismatched types
143  --> $DIR/loop-break-value.rs:80:15
144   |
145LL |         break (break, break);
146   |               ^^^^^^^^^^^^^^ expected (), found tuple
147   |
148   = note: expected type `()`
149              found type `(!, !)`
150
151error[E0308]: mismatched types
152  --> $DIR/loop-break-value.rs:85:15
153   |
154LL |         break 2;
155   |               ^ expected (), found integer
156   |
157   = note: expected type `()`
158              found type `{integer}`
159
160error[E0308]: mismatched types
161  --> $DIR/loop-break-value.rs:90:9
162   |
163LL |         break;
164   |         ^^^^^
165   |         |
166   |         expected integer, found ()
167   |         help: give it a value of the expected type: `break value`
168   |
169   = note: expected type `{integer}`
170              found type `()`
171
172error: aborting due to 16 previous errors
173
174Some errors have detailed explanations: E0308, E0571.
175For more information about an error, try `rustc --explain E0308`.