diff options
Diffstat (limited to 'tests/ui/loops/loop-no-implicit-break.rs')
-rw-r--r-- | tests/ui/loops/loop-no-implicit-break.rs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/loops/loop-no-implicit-break.rs b/tests/ui/loops/loop-no-implicit-break.rs new file mode 100644 index 000000000..93078cb4b --- /dev/null +++ b/tests/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 + } +} |