From e38685cb48a44c3321922f5f7228072b503d2973 Mon Sep 17 00:00:00 2001 From: Avi Dessauer Date: Mon, 8 Jun 2020 17:49:06 -0400 Subject: Parse default unsafe fn --- crates/ra_parser/src/grammar/items.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crates/ra_parser/src/grammar') diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 9c14b954a..56cfb509d 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs @@ -121,7 +121,13 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul T![unsafe] => { // test default_unsafe_impl // default unsafe impl Foo {} - if p.nth(2) == T![impl] { + + // test default_unsafe_fn + // impl T for Foo { + // default unsafe fn foo() {} + // } + let sk = p.nth(2); + if sk == T![impl] || sk == T![fn] { p.bump_remap(T![default]); p.bump(T![unsafe]); has_mods = true; -- cgit v1.2.3 From 2785362a1f9a3436072152e5499ac5d7c4d98cc4 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 9 Jun 2020 10:50:25 +0200 Subject: Update crates/ra_parser/src/grammar/items.rs --- crates/ra_parser/src/grammar/items.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'crates/ra_parser/src/grammar') diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 56cfb509d..97642bc24 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs @@ -126,8 +126,7 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul // impl T for Foo { // default unsafe fn foo() {} // } - let sk = p.nth(2); - if sk == T![impl] || sk == T![fn] { + if p.nth(2) == T![impl] || p.nth(2) == T![fn] { p.bump_remap(T![default]); p.bump(T![unsafe]); has_mods = true; -- cgit v1.2.3