aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser/src/grammar/items.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_parser/src/grammar/items.rs')
-rw-r--r--crates/ra_parser/src/grammar/items.rs62
1 files changed, 8 insertions, 54 deletions
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs
index 9b7623434..d091b0fbb 100644
--- a/crates/ra_parser/src/grammar/items.rs
+++ b/crates/ra_parser/src/grammar/items.rs
@@ -132,6 +132,8 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker) -> Result<(), Marker> {
132 } 132 }
133 } 133 }
134 134
135 // test existential_type
136 // existential type Foo: Fn() -> usize;
135 if p.at(IDENT) && p.at_contextual_kw("existential") && p.nth(1) == T![type] { 137 if p.at(IDENT) && p.at_contextual_kw("existential") && p.nth(1) == T![type] {
136 p.bump_remap(T![existential]); 138 p.bump_remap(T![existential]);
137 has_mods = true; 139 has_mods = true;
@@ -139,79 +141,31 @@ pub(super) fn maybe_item(p: &mut Parser, m: Marker) -> Result<(), Marker> {
139 141
140 // items 142 // items
141 match p.current() { 143 match p.current() {
142 // test async_fn 144 // test fn
143 // async fn foo() {} 145 // fn foo() {}
144
145 // test extern_fn
146 // extern fn foo() {}
147
148 // test const_fn
149 // const fn foo() {}
150
151 // test const_unsafe_fn
152 // const unsafe fn foo() {}
153
154 // test unsafe_extern_fn
155 // unsafe extern "C" fn foo() {}
156
157 // test unsafe_fn
158 // unsafe fn foo() {}
159
160 // test combined_fns
161 // async unsafe fn foo() {}
162 // const unsafe fn bar() {}
163
164 // test_err wrong_order_fns
165 // unsafe async fn foo() {}
166 // unsafe const fn bar() {}
167 T![fn] => { 146 T![fn] => {
168 fn_def(p); 147 fn_def(p);
169 m.complete(p, FN); 148 m.complete(p, FN);
170 } 149 }
171 150
172 // test unsafe_trait 151 // test trait
173 // unsafe trait T {} 152 // trait T {}
174
175 // test auto_trait
176 // auto trait T {}
177
178 // test unsafe_auto_trait
179 // unsafe auto trait T {}
180 T![trait] => { 153 T![trait] => {
181 traits::trait_def(p); 154 traits::trait_def(p);
182 m.complete(p, TRAIT); 155 m.complete(p, TRAIT);
183 } 156 }
184 157
185 // test unsafe_impl
186 // unsafe impl Foo {}
187
188 // test default_impl
189 // default impl Foo {}
190
191 // test_err default_fn_type
192 // trait T {
193 // default type T = Bar;
194 // default fn foo() {}
195 // }
196
197 // test default_fn_type
198 // impl T for Foo {
199 // default type T = Bar;
200 // default fn foo() {}
201 // }
202 T![const] => { 158 T![const] => {
203 consts::const_def(p, m); 159 consts::const_def(p, m);
204 } 160 }
205 161
206 // test unsafe_default_impl 162 // test impl
207 // unsafe default impl Foo {} 163 // impl T for S {}
208 T![impl] => { 164 T![impl] => {
209 traits::impl_def(p); 165 traits::impl_def(p);
210 m.complete(p, IMPL); 166 m.complete(p, IMPL);
211 } 167 }
212 168
213 // test existential_type
214 // existential type Foo: Fn() -> usize;
215 T![type] => { 169 T![type] => {
216 type_def(p, m); 170 type_def(p, m);
217 } 171 }