We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b4c3b83 commit 8746b84Copy full SHA for 8746b84
src/comp/front/parser.rs
@@ -891,6 +891,8 @@ fn parse_bottom_expr(&parser p) -> @ast::expr {
891
} else if (eat_word(p, "ret")) {
892
alt (p.peek()) {
893
case (token::SEMI) { ex = ast::expr_ret(none); }
894
+ // Handle ret as the block result expression
895
+ case (token::RBRACE) { ex = ast::expr_ret(none); }
896
case (_) {
897
auto e = parse_expr(p);
898
hi = e.span.hi;
src/test/run-pass/expr-empty-ret.rs
@@ -0,0 +1,11 @@
1
+// xfail-stage0
2
+// Issue #521
3
+
4
+fn f() {
5
+ auto x = alt (true) {
6
+ case (true) { 10 }
7
+ case (false) { ret }
8
+ };
9
+}
10
11
+fn main() { }
0 commit comments