Repository: rust-analyzer/rust-analyzer
Pull request #304 (2018-12-20 18:25:49)

Support a blank expression before a semicolon
Part of fixing #290.

Note that I have not run `gen-tests` as I don't want to conflict with #299.

matklad: bors delegate+
bors[bot]: :v: DJMcNab can now approve this pull request
matklad: bors try
bors[bot]: ## try

# Build failed
  * [continuous-integration/travis-ci/push](https://travis-ci.org/rust-analyzer/rust-analyzer/builds/470654815?utm_source=github_status&utm_medium=notification)

Patch:
diff --git a/crates/ra_syntax/src/grammar/expressions.rs b/crates/ra_syntax/src/grammar/expressions.rs
index 1608b1a731..da78d85a2f 100644
--- a/crates/ra_syntax/src/grammar/expressions.rs
+++ b/crates/ra_syntax/src/grammar/expressions.rs
@@ -42,9 +42,15 @@ pub(crate) fn block(p: &mut Parser) {
     }
     let m = p.start();
     p.bump();
+
     while !p.at(EOF) && !p.at(R_CURLY) {
         match p.current() {
             LET_KW => let_stmt(p),
+            // test nocontentexpr
+            // fn foo(){
+            //     ;;;some_expr();;;;{;;;};;;;Ok(())
+            // }
+            SEMI => p.bump(),
             _ => {
                 // test block_items
                 // fn a() { fn b() {} }


Test patch:
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0113_nocontentexpr.rs b/crates/ra_syntax/tests/data/parser/inline/ok/0113_nocontentexpr.rs
new file mode 100644
index 0000000000..bbf09e367c
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0113_nocontentexpr.rs
@@ -0,0 +1,3 @@
+fn foo(){
+    ;;;some_expr();;;;{;;;};;;;Ok(())
+}
diff --git a/crates/ra_syntax/tests/data/parser/inline/ok/0113_nocontentexpr.txt b/crates/ra_syntax/tests/data/parser/inline/ok/0113_nocontentexpr.txt
new file mode 100644
index 0000000000..db91e30754
--- /dev/null
+++ b/crates/ra_syntax/tests/data/parser/inline/ok/0113_nocontentexpr.txt
@@ -0,0 +1,56 @@
+SOURCE_FILE@[0; 50)
+  FN_DEF@[0; 49)
+    FN_KW@[0; 2)
+    WHITESPACE@[2; 3)
+    NAME@[3; 6)
+      IDENT@[3; 6) "foo"
+    PARAM_LIST@[6; 8)
+      L_PAREN@[6; 7)
+      R_PAREN@[7; 8)
+    BLOCK@[8; 49)
+      L_CURLY@[8; 9)
+      WHITESPACE@[9; 14)
+      SEMI@[14; 15)
+      SEMI@[15; 16)
+      SEMI@[16; 17)
+      EXPR_STMT@[17; 29)
+        CALL_EXPR@[17; 28)
+          PATH_EXPR@[17; 26)
+            PATH@[17; 26)
+              PATH_SEGMENT@[17; 26)
+                NAME_REF@[17; 26)
+                  IDENT@[17; 26) "some_expr"
+          ARG_LIST@[26; 28)
+            L_PAREN@[26; 27)
+            R_PAREN@[27; 28)
+        SEMI@[28; 29)
+      SEMI@[29; 30)
+      SEMI@[30; 31)
+      SEMI@[31; 32)
+      EXPR_STMT@[32; 38)
+        BLOCK_EXPR@[32; 37)
+          BLOCK@[32; 37)
+            L_CURLY@[32; 33)
+            SEMI@[33; 34)
+            SEMI@[34; 35)
+            SEMI@[35; 36)
+            R_CURLY@[36; 37)
+        SEMI@[37; 38)
+      SEMI@[38; 39)
+      SEMI@[39; 40)
+      SEMI@[40; 41)
+      CALL_EXPR@[41; 47)
+        PATH_EXPR@[41; 43)
+          PATH@[41; 43)
+            PATH_SEGMENT@[41; 43)
+              NAME_REF@[41; 43)
+                IDENT@[41; 43) "Ok"
+        ARG_LIST@[43; 47)
+          L_PAREN@[43; 44)
+          TUPLE_EXPR@[44; 46)
+            L_PAREN@[44; 45)
+            R_PAREN@[45; 46)
+          R_PAREN@[46; 47)
+      WHITESPACE@[47; 48)
+      R_CURLY@[48; 49)
+  WHITESPACE@[49; 50)