diff options
Diffstat (limited to 'src/test/ui/closures/closure-return-type-mismatch.rs')
-rw-r--r-- | src/test/ui/closures/closure-return-type-mismatch.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/ui/closures/closure-return-type-mismatch.rs b/src/test/ui/closures/closure-return-type-mismatch.rs new file mode 100644 index 000000000..1631bb303 --- /dev/null +++ b/src/test/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 + }; +} |