blob: c35200520cb5d8c4a8dc0b2d73d1a4381a352620 (
plain)
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
|
#![feature(never_type)]
fn main() {
let val: ! = loop { break break; };
//~^ ERROR mismatched types
loop {
if true {
break "asdf";
} else {
break 123; //~ ERROR mismatched types
}
};
let _: i32 = loop {
break "asdf"; //~ ERROR mismatched types
};
let _: i32 = 'outer_loop: loop {
loop {
break 'outer_loop "nope"; //~ ERROR mismatched types
break "ok";
};
};
'while_loop: while true { //~ WARN denote infinite loops with
break;
break (); //~ ERROR `break` with value from a `while` loop
loop {
break 'while_loop 123;
//~^ ERROR `break` with value from a `while` loop
break 456;
break 789;
};
}
while let Some(_) = Some(()) {
if break () { //~ ERROR `break` with value from a `while` loop
}
}
while let Some(_) = Some(()) {
break None;
//~^ ERROR `break` with value from a `while` loop
}
'while_let_loop: while let Some(_) = Some(()) {
loop {
break 'while_let_loop "nope";
//~^ ERROR `break` with value from a `while` loop
break 33;
};
}
for _ in &[1,2,3] {
break (); //~ ERROR `break` with value from a `for` loop
break [()];
//~^ ERROR `break` with value from a `for` loop
}
'for_loop: for _ in &[1,2,3] {
loop {
break Some(3);
break 'for_loop Some(17);
//~^ ERROR `break` with value from a `for` loop
};
}
let _: i32 = 'a: loop {
let _: () = 'b: loop {
break ('c: loop {
break;
break 'c 123; //~ ERROR mismatched types
});
break 'a 123;
};
};
loop {
break (break, break); //~ ERROR mismatched types
};
loop {
break;
break 2; //~ ERROR mismatched types
};
loop {
break 2;
break; //~ ERROR mismatched types
break 4;
};
'LOOP: for _ in 0 .. 9 {
break LOOP;
//~^ ERROR cannot find value `LOOP` in this scope
}
let _ = 'a: loop {
loop {
break; // This doesn't affect the expected break type of the 'a loop
loop {
loop {
break 'a 1;
}
}
}
break; //~ ERROR mismatched types
};
let _ = 'a: loop {
loop {
break; // This doesn't affect the expected break type of the 'a loop
loop {
loop {
break 'a 1;
}
}
}
break 'a; //~ ERROR mismatched types
};
loop {
break;
let _ = loop {
break 2;
loop {
break;
}
};
break 2; //~ ERROR mismatched types
}
'a: loop {
break;
let _ = 'a: loop {
//~^ WARNING label name `'a` shadows a label name that is already in scope
break 2;
loop {
break 'a; //~ ERROR mismatched types
}
};
break 2; //~ ERROR mismatched types
}
'a: loop {
break;
let _ = 'a: loop {
//~^ WARNING label name `'a` shadows a label name that is already in scope
break 'a 2;
loop {
break 'a; //~ ERROR mismatched types
}
};
break 2; //~ ERROR mismatched types
};
loop { // point at the return type
break 2; //~ ERROR mismatched types
}
}
|