diff options
Diffstat (limited to '')
-rw-r--r-- | src/test/ui/closures/semistatement-in-lambda.rs | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/test/ui/closures/semistatement-in-lambda.rs b/src/test/ui/closures/semistatement-in-lambda.rs new file mode 100644 index 000000000..ebd55e0ba --- /dev/null +++ b/src/test/ui/closures/semistatement-in-lambda.rs @@ -0,0 +1,12 @@ +// run-pass + +#![allow(unused_must_use)] + +pub fn main() { + // Test that lambdas behave as unary expressions with block-like expressions + -if true { 1 } else { 2 } * 3; + || if true { 1 } else { 2 } * 3; + + // The following is invalid and parses as `if true { 1 } else { 2 }; *3` + // if true { 1 } else { 2 } * 3 +} |