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