summaryrefslogtreecommitdiffstats
path: root/src/test/ui/loops/loop-no-implicit-break.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/test/ui/loops/loop-no-implicit-break.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/loops/loop-no-implicit-break.rs b/src/test/ui/loops/loop-no-implicit-break.rs
new file mode 100644
index 000000000..93078cb4b
--- /dev/null
+++ b/src/test/ui/loops/loop-no-implicit-break.rs
@@ -0,0 +1,31 @@
+fn main() {
+ let a: i8 = loop {
+ 1 //~ ERROR mismatched types
+ };
+
+ let b: i8 = loop {
+ break 1;
+ };
+}
+
+fn foo() -> i8 {
+ let a: i8 = loop {
+ 1 //~ ERROR mismatched types
+ };
+
+ let b: i8 = loop {
+ break 1;
+ };
+
+ loop {
+ 1 //~ ERROR mismatched types
+ }
+
+ loop {
+ return 1;
+ }
+
+ loop {
+ 1 //~ ERROR mismatched types
+ }
+}