@@ -389,24 +389,33 @@ impl PathSegment {
389
389
}
390
390
}
391
391
392
+ #[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
393
+ pub struct ConstArg {
394
+ pub value : AnonConst ,
395
+ pub span : Span ,
396
+ }
397
+
392
398
#[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
393
399
pub enum GenericArg {
394
400
Lifetime ( Lifetime ) ,
395
401
Type ( Ty ) ,
402
+ Const ( ConstArg ) ,
396
403
}
397
404
398
405
impl GenericArg {
399
406
pub fn span ( & self ) -> Span {
400
407
match self {
401
408
GenericArg :: Lifetime ( l) => l. span ,
402
409
GenericArg :: Type ( t) => t. span ,
410
+ GenericArg :: Const ( c) => c. span ,
403
411
}
404
412
}
405
413
406
414
pub fn id ( & self ) -> NodeId {
407
415
match self {
408
416
GenericArg :: Lifetime ( l) => l. id ,
409
417
GenericArg :: Type ( t) => t. id ,
418
+ GenericArg :: Const ( c) => c. value . id ,
410
419
}
411
420
}
412
421
}
@@ -448,6 +457,7 @@ impl GenericArgs {
448
457
}
449
458
break ;
450
459
}
460
+ GenericArg :: Const ( _) => { }
451
461
}
452
462
}
453
463
}
@@ -464,6 +474,7 @@ impl GenericArgs {
464
474
match arg {
465
475
GenericArg :: Lifetime ( _) => own_counts. lifetimes += 1 ,
466
476
GenericArg :: Type ( _) => own_counts. types += 1 ,
477
+ GenericArg :: Const ( _) => own_counts. consts += 1 ,
467
478
} ;
468
479
}
469
480
@@ -528,6 +539,9 @@ pub enum GenericParamKind {
528
539
Type {
529
540
default : Option < P < Ty > > ,
530
541
synthetic : Option < SyntheticTyParamKind > ,
542
+ } ,
543
+ Const {
544
+ ty : P < Ty > ,
531
545
}
532
546
}
533
547
@@ -548,6 +562,7 @@ pub struct GenericParam {
548
562
pub struct GenericParamCount {
549
563
pub lifetimes : usize ,
550
564
pub types : usize ,
565
+ pub consts : usize ,
551
566
}
552
567
553
568
/// Represents lifetimes and type parameters attached to a declaration
@@ -582,6 +597,7 @@ impl Generics {
582
597
match param. kind {
583
598
GenericParamKind :: Lifetime { .. } => own_counts. lifetimes += 1 ,
584
599
GenericParamKind :: Type { .. } => own_counts. types += 1 ,
600
+ GenericParamKind :: Const { .. } => own_counts. consts += 1 ,
585
601
} ;
586
602
}
587
603
@@ -1302,7 +1318,7 @@ impl BodyOwnerKind {
1302
1318
/// These are usually found nested inside types (e.g., array lengths)
1303
1319
/// or expressions (e.g., repeat counts), and also used to define
1304
1320
/// explicit discriminant values for enum variants.
1305
- #[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Debug ) ]
1321
+ #[ derive( Copy , Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Debug ) ]
1306
1322
pub struct AnonConst {
1307
1323
pub id : NodeId ,
1308
1324
pub hir_id : HirId ,
0 commit comments