diff options
Diffstat (limited to 'tests/ui/closures/closure-return-type-mismatch.rs')
-rw-r--r-- | tests/ui/closures/closure-return-type-mismatch.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ui/closures/closure-return-type-mismatch.rs b/tests/ui/closures/closure-return-type-mismatch.rs new file mode 100644 index 000000000..1631bb303 --- /dev/null +++ b/tests/ui/closures/closure-return-type-mismatch.rs @@ -0,0 +1,17 @@ +fn main() { + || { + if false { + return "test"; + } + let a = true; + a //~ ERROR mismatched types + }; + + || -> bool { + if false { + return "hello" //~ ERROR mismatched types + }; + let b = true; + b + }; +} |