@@ -389,24 +389,33 @@ impl PathSegment {
389389 }
390390}
391391
392+ #[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
393+ pub struct ConstArg {
394+ pub value : AnonConst ,
395+ pub span : Span ,
396+ }
397+
392398#[ derive( Clone , RustcEncodable , RustcDecodable , Debug ) ]
393399pub enum GenericArg {
394400 Lifetime ( Lifetime ) ,
395401 Type ( Ty ) ,
402+ Const ( ConstArg ) ,
396403}
397404
398405impl GenericArg {
399406 pub fn span ( & self ) -> Span {
400407 match self {
401408 GenericArg :: Lifetime ( l) => l. span ,
402409 GenericArg :: Type ( t) => t. span ,
410+ GenericArg :: Const ( c) => c. span ,
403411 }
404412 }
405413
406414 pub fn id ( & self ) -> NodeId {
407415 match self {
408416 GenericArg :: Lifetime ( l) => l. id ,
409417 GenericArg :: Type ( t) => t. id ,
418+ GenericArg :: Const ( c) => c. value . id ,
410419 }
411420 }
412421}
@@ -448,6 +457,7 @@ impl GenericArgs {
448457 }
449458 break ;
450459 }
460+ GenericArg :: Const ( _) => { }
451461 }
452462 }
453463 }
@@ -464,6 +474,7 @@ impl GenericArgs {
464474 match arg {
465475 GenericArg :: Lifetime ( _) => own_counts. lifetimes += 1 ,
466476 GenericArg :: Type ( _) => own_counts. types += 1 ,
477+ GenericArg :: Const ( _) => own_counts. consts += 1 ,
467478 } ;
468479 }
469480
@@ -528,6 +539,9 @@ pub enum GenericParamKind {
528539 Type {
529540 default : Option < P < Ty > > ,
530541 synthetic : Option < SyntheticTyParamKind > ,
542+ } ,
543+ Const {
544+ ty : P < Ty > ,
531545 }
532546}
533547
@@ -548,6 +562,7 @@ pub struct GenericParam {
548562pub struct GenericParamCount {
549563 pub lifetimes : usize ,
550564 pub types : usize ,
565+ pub consts : usize ,
551566}
552567
553568/// Represents lifetimes and type parameters attached to a declaration
@@ -582,6 +597,7 @@ impl Generics {
582597 match param. kind {
583598 GenericParamKind :: Lifetime { .. } => own_counts. lifetimes += 1 ,
584599 GenericParamKind :: Type { .. } => own_counts. types += 1 ,
600+ GenericParamKind :: Const { .. } => own_counts. consts += 1 ,
585601 } ;
586602 }
587603
@@ -1302,7 +1318,7 @@ impl BodyOwnerKind {
13021318/// These are usually found nested inside types (e.g., array lengths)
13031319/// or expressions (e.g., repeat counts), and also used to define
13041320/// explicit discriminant values for enum variants.
1305- #[ derive( Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Debug ) ]
1321+ #[ derive( Copy , Clone , PartialEq , Eq , RustcEncodable , RustcDecodable , Debug ) ]
13061322pub struct AnonConst {
13071323 pub id : NodeId ,
13081324 pub hir_id : HirId ,
0 commit comments