1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332
|
warning: label name `'a` shadows a label name that is already in scope
--> $DIR/loop-break-value.rs:136:17
|
LL | 'a: loop {
| -- first declared here
LL | break;
LL | let _ = 'a: loop {
| ^^ label `'a` already in scope
warning: label name `'a` shadows a label name that is already in scope
--> $DIR/loop-break-value.rs:148:17
|
LL | 'a: loop {
| -- first declared here
LL | break;
LL | let _ = 'a: loop {
| ^^ label `'a` already in scope
error[E0425]: cannot find value `LOOP` in this scope
--> $DIR/loop-break-value.rs:95:15
|
LL | 'LOOP: for _ in 0 .. 9 {
| ----- a label with a similar name exists
LL | break LOOP;
| ^^^^
| |
| not found in this scope
| help: use the similarly named label: `'LOOP`
warning: denote infinite loops with `loop { ... }`
--> $DIR/loop-break-value.rs:26:5
|
LL | 'while_loop: while true {
| ^^^^^^^^^^^^^^^^^^^^^^^ help: use `loop`
|
= note: `#[warn(while_true)]` on by default
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:28:9
|
LL | 'while_loop: while true {
| ----------------------- you can't `break` with a value in a `while` loop
LL | break;
LL | break ();
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
|
LL | break;
| ~~~~~
help: alternatively, you might have meant to use the available loop label
|
LL | break 'while_loop;
| ~~~~~~~~~~~
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:30:13
|
LL | 'while_loop: while true {
| ----------------------- you can't `break` with a value in a `while` loop
...
LL | break 'while_loop 123;
| ^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
|
LL | break 'while_loop;
| ~~~~~~~~~~~~~~~~~
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:38:12
|
LL | while let Some(_) = Some(()) {
| ---------------------------- you can't `break` with a value in a `while` loop
LL | if break () {
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
|
LL | if break {
| ~~~~~
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:43:9
|
LL | while let Some(_) = Some(()) {
| ---------------------------- you can't `break` with a value in a `while` loop
LL | break None;
| ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
|
LL | break;
| ~~~~~
error[E0571]: `break` with value from a `while` loop
--> $DIR/loop-break-value.rs:49:13
|
LL | 'while_let_loop: while let Some(_) = Some(()) {
| --------------------------------------------- you can't `break` with a value in a `while` loop
LL | loop {
LL | break 'while_let_loop "nope";
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `while` loop
|
LL | break 'while_let_loop;
| ~~~~~~~~~~~~~~~~~~~~~
error[E0571]: `break` with value from a `for` loop
--> $DIR/loop-break-value.rs:56:9
|
LL | for _ in &[1,2,3] {
| ----------------- you can't `break` with a value in a `for` loop
LL | break ();
| ^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `for` loop
|
LL | break;
| ~~~~~
error[E0571]: `break` with value from a `for` loop
--> $DIR/loop-break-value.rs:57:9
|
LL | for _ in &[1,2,3] {
| ----------------- you can't `break` with a value in a `for` loop
LL | break ();
LL | break [()];
| ^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `for` loop
|
LL | break;
| ~~~~~
error[E0571]: `break` with value from a `for` loop
--> $DIR/loop-break-value.rs:64:13
|
LL | 'for_loop: for _ in &[1,2,3] {
| ---------------------------- you can't `break` with a value in a `for` loop
...
LL | break 'for_loop Some(17);
| ^^^^^^^^^^^^^^^^^^^^^^^^ can only break with a value inside `loop` or breakable block
|
help: use `break` on its own without a value inside this `for` loop
|
LL | break 'for_loop;
| ~~~~~~~~~~~~~~~
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:4:31
|
LL | let val: ! = loop { break break; };
| --- ---- ^^^^^ expected `!`, found `()`
| | |
| | this loop is expected to be of type `!`
| expected because of this assignment
|
= note: expected type `!`
found unit type `()`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:11:19
|
LL | break "asdf";
| ------------ expected because of this `break`
LL | } else {
LL | break 123;
| ^^^ expected `&str`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:16:15
|
LL | let _: i32 = loop {
| - ---- this loop is expected to be of type `i32`
| |
| expected because of this assignment
LL | break "asdf";
| ^^^^^^ expected `i32`, found `&str`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:21:31
|
LL | let _: i32 = 'outer_loop: loop {
| - ---- this loop is expected to be of type `i32`
| |
| expected because of this assignment
LL | loop {
LL | break 'outer_loop "nope";
| ^^^^^^ expected `i32`, found `&str`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:73:26
|
LL | break;
| ----- expected because of this `break`
LL | break 'c 123;
| ^^^ expected `()`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:80:15
|
LL | break (break, break);
| ^-----^^-----^
| || |
| || expected because of this `break`
| |expected because of this `break`
| expected `()`, found `(!, !)`
|
= note: expected unit type `()`
found tuple `(!, !)`
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:85:15
|
LL | break;
| ----- expected because of this `break`
LL | break 2;
| ^ expected `()`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:90:9
|
LL | break 2;
| ------- expected because of this `break`
LL | break;
| ^^^^^ expected integer, found `()`
|
help: give it a value of the expected type
|
LL | break value;
| +++++
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:108:9
|
LL | break 'a 1;
| ---------- expected because of this `break`
...
LL | break;
| ^^^^^ expected integer, found `()`
|
help: give it a value of the expected type
|
LL | break value;
| +++++
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:120:9
|
LL | break 'a 1;
| ---------- expected because of this `break`
...
LL | break 'a;
| ^^^^^^^^ expected integer, found `()`
|
help: give it a value of the expected type
|
LL | break 'a value;
| +++++
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:131:15
|
LL | break;
| ----- expected because of this `break`
...
LL | break 2;
| ^ expected `()`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:140:17
|
LL | break 2;
| ------- expected because of this `break`
LL | loop {
LL | break 'a;
| ^^^^^^^^ expected integer, found `()`
|
help: give it a value of the expected type
|
LL | break 'a value;
| +++++
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:143:15
|
LL | break;
| ----- expected because of this `break`
...
LL | break 2;
| ^ expected `()`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:152:17
|
LL | break 'a 2;
| ---------- expected because of this `break`
LL | loop {
LL | break 'a;
| ^^^^^^^^ expected integer, found `()`
|
help: give it a value of the expected type
|
LL | break 'a value;
| +++++
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:155:15
|
LL | break;
| ----- expected because of this `break`
...
LL | break 2;
| ^ expected `()`, found integer
error[E0308]: mismatched types
--> $DIR/loop-break-value.rs:159:15
|
LL | fn main() {
| - expected `()` because of this return type
...
LL | loop { // point at the return type
| ---- this loop is expected to be of type `()`
LL | break 2;
| ^ expected `()`, found integer
error: aborting due to 25 previous errors; 3 warnings emitted
Some errors have detailed explanations: E0308, E0425, E0571.
For more information about an error, try `rustc --explain E0308`.
|