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