aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser')
-rw-r--r--crates/ra_parser/src/grammar/expressions.rs11
-rw-r--r--crates/ra_parser/src/grammar/items.rs16
2 files changed, 20 insertions, 7 deletions
diff --git a/crates/ra_parser/src/grammar/expressions.rs b/crates/ra_parser/src/grammar/expressions.rs
index 795dccea1..298030cb9 100644
--- a/crates/ra_parser/src/grammar/expressions.rs
+++ b/crates/ra_parser/src/grammar/expressions.rs
@@ -181,6 +181,17 @@ pub(crate) fn expr_block_contents(p: &mut Parser) {
181 // fn foo(){ 181 // fn foo(){
182 // ;;;some_expr();;;;{;;;};;;;Ok(()) 182 // ;;;some_expr();;;;{;;;};;;;Ok(())
183 // } 183 // }
184
185 // test nocontentexpr_after_item
186 // fn simple_function() {
187 // enum LocalEnum {
188 // One,
189 // Two,
190 // };
191 // fn f() {};
192 // struct S {};
193 // }
194
184 if p.current() == T![;] { 195 if p.current() == T![;] {
185 p.bump(); 196 p.bump();
186 continue; 197 continue;
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 424d0476d..543af7c4b 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -38,7 +38,15 @@ pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool, flavor: ItemF
38 let m = p.start(); 38 let m = p.start();
39 attributes::outer_attributes(p); 39 attributes::outer_attributes(p);
40 let m = match maybe_item(p, m, flavor) { 40 let m = match maybe_item(p, m, flavor) {
41 Ok(()) => return, 41 Ok(()) => {
42 if p.at(T![;]) {
43 p.err_and_bump(
44 "expected item, found `;`\n\
45 consider removing this semicolon",
46 );
47 }
48 return;
49 }
42 Err(m) => m, 50 Err(m) => m,
43 }; 51 };
44 if paths::is_path_start(p) { 52 if paths::is_path_start(p) {
@@ -263,12 +271,6 @@ fn items_without_modifiers(p: &mut Parser, m: Marker) -> Result<(), Marker> {
263 } 271 }
264 _ => return Err(m), 272 _ => return Err(m),
265 }; 273 };
266 if p.at(T![;]) {
267 p.err_and_bump(
268 "expected item, found `;`\n\
269 consider removing this semicolon",
270 );
271 }
272 Ok(()) 274 Ok(())
273} 275}
274 276