Skip to content

Commit e38685c

Browse files
committed
Parse default unsafe fn
1 parent 3999bbb commit e38685c

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

crates/ra_parser/src/grammar/items.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul
121121
T![unsafe] => {
122122
// test default_unsafe_impl
123123
// default unsafe impl Foo {}
124-
if p.nth(2) == T![impl] {
124+
125+
// test default_unsafe_fn
126+
// impl T for Foo {
127+
// default unsafe fn foo() {}
128+
// }
129+
let sk = p.nth(2);
130+
if sk == T![impl] || sk == T![fn] {
125131
p.bump_remap(T![default]);
126132
p.bump(T![unsafe]);
127133
has_mods = true;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
impl T for Foo {
2+
default unsafe fn foo() {}
3+
}

0 commit comments

Comments
 (0)