File tree 2 files changed +39
-0
lines changed
2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change @@ -566,6 +566,19 @@ module.exports = grammar({
566
566
field ( 'name' , $ . identifier ) ,
567
567
':' ,
568
568
field ( 'type' , $ . _type ) ,
569
+ optional (
570
+ seq (
571
+ '=' ,
572
+ field ( 'value' ,
573
+ choice (
574
+ $ . block ,
575
+ $ . identifier ,
576
+ $ . _literal ,
577
+ $ . negative_literal ,
578
+ ) ,
579
+ ) ,
580
+ ) ,
581
+ ) ,
569
582
) ,
570
583
571
584
constrained_type_parameter : $ => seq (
Original file line number Diff line number Diff line change @@ -2413,3 +2413,29 @@ where
2413
2413
(type_arguments
2414
2414
(type_identifier))))))
2415
2415
(block)))
2416
+
2417
+ ================================================================================
2418
+ Const generics with default
2419
+ ================================================================================
2420
+
2421
+ pub struct Loaf<T: Sized, const N: usize = 1>([T; N]);
2422
+
2423
+ --------------------------------------------------------------------------------
2424
+
2425
+ (source_file
2426
+ (struct_item
2427
+ (visibility_modifier)
2428
+ (type_identifier)
2429
+ (type_parameters
2430
+ (constrained_type_parameter
2431
+ (type_identifier)
2432
+ (trait_bounds
2433
+ (type_identifier)))
2434
+ (const_parameter
2435
+ (identifier)
2436
+ (primitive_type)
2437
+ (integer_literal)))
2438
+ (ordered_field_declaration_list
2439
+ (array_type
2440
+ (type_identifier)
2441
+ (identifier)))))
You can’t perform that action at this time.
0 commit comments