fork/rust

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

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

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