diff options
Diffstat (limited to 'crates/ra_parser/src/grammar/items.rs')
-rw-r--r-- | crates/ra_parser/src/grammar/items.rs | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 67a924de5..9c14b954a 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs | |||
@@ -118,7 +118,17 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul | |||
118 | && p.at_contextual_kw("default") | 118 | && p.at_contextual_kw("default") |
119 | && (match p.nth(1) { | 119 | && (match p.nth(1) { |
120 | T![impl] => true, | 120 | T![impl] => true, |
121 | T![fn] | T![type] => { | 121 | T![unsafe] => { |
122 | // test default_unsafe_impl | ||
123 | // default unsafe impl Foo {} | ||
124 | if p.nth(2) == T![impl] { | ||
125 | p.bump_remap(T![default]); | ||
126 | p.bump(T![unsafe]); | ||
127 | has_mods = true; | ||
128 | } | ||
129 | false | ||
130 | } | ||
131 | T![fn] | T![type] | T![const] => { | ||
122 | if let ItemFlavor::Mod = flavor { | 132 | if let ItemFlavor::Mod = flavor { |
123 | true | 133 | true |
124 | } else { | 134 | } else { |
@@ -198,6 +208,9 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker, flavor: ItemFlavor) -> Resul | |||
198 | // default type T = Bar; | 208 | // default type T = Bar; |
199 | // default fn foo() {} | 209 | // default fn foo() {} |
200 | // } | 210 | // } |
211 | T![const] => { | ||
212 | consts::const_def(p, m); | ||
213 | } | ||
201 | 214 | ||
202 | // test unsafe_default_impl | 215 | // test unsafe_default_impl |
203 | // unsafe default impl Foo {} | 216 | // unsafe default impl Foo {} |