Skip to content

Commit f752f4b

Browse files
committed
parse unit structs with where clauses
1 parent 3691201 commit f752f4b

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

grammar.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,10 @@ module.exports = grammar({
308308
optional($.where_clause),
309309
';',
310310
),
311-
';',
311+
seq(
312+
optional($.where_clause),
313+
';',
314+
),
312315
),
313316
),
314317

test/corpus/declarations.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2257,6 +2257,8 @@ fn foo<A>() where A: B + As<f64>, f64: As<A> {}
22572257

22582258
impl<A> Default for B<A> where *mut A: C + D {}
22592259

2260+
struct A where i32: Copy;
2261+
22602262
--------------------------------------------------------------------------------
22612263

22622264
(source_file
@@ -2455,7 +2457,14 @@ impl<A> Default for B<A> where *mut A: C + D {}
24552457
bounds: (trait_bounds
24562458
(type_identifier)
24572459
(type_identifier))))
2458-
body: (declaration_list)))
2460+
body: (declaration_list))
2461+
(struct_item
2462+
name: (type_identifier)
2463+
(where_clause
2464+
(where_predicate
2465+
left: (primitive_type)
2466+
bounds: (trait_bounds
2467+
(type_identifier))))))
24592468

24602469
================================================================================
24612470
External Modules

0 commit comments

Comments
 (0)