@@ -242,9 +242,23 @@ impl<'hir> PathSegment<'hir> {
242242}
243243
244244#[ derive( Clone , Copy , Debug , HashStable_Generic ) ]
245- pub struct ConstArg {
246- pub value : AnonConst ,
247- pub span : Span ,
245+ pub struct ConstArg < ' hir > {
246+ pub kind : ConstArgKind < ' hir > ,
247+ }
248+
249+ #[ derive( Clone , Copy , Debug , HashStable_Generic ) ]
250+ pub enum ConstArgKind < ' hir > {
251+ AnonConst ( Span , AnonConst ) ,
252+ Param ( HirId , QPath < ' hir > ) ,
253+ }
254+
255+ impl < ' hir > ConstArg < ' hir > {
256+ pub fn span ( & self ) -> Span {
257+ match self . kind {
258+ ConstArgKind :: AnonConst ( span, _) => span,
259+ ConstArgKind :: Param ( _, qpath) => qpath. span ( ) ,
260+ }
261+ }
248262}
249263
250264#[ derive( Clone , Copy , Debug , HashStable_Generic ) ]
@@ -263,7 +277,7 @@ impl InferArg {
263277pub enum GenericArg < ' hir > {
264278 Lifetime ( & ' hir Lifetime ) ,
265279 Type ( & ' hir Ty < ' hir > ) ,
266- Const ( ConstArg ) ,
280+ Const ( & ' hir ConstArg < ' hir > ) ,
267281 Infer ( InferArg ) ,
268282}
269283
@@ -272,7 +286,7 @@ impl GenericArg<'_> {
272286 match self {
273287 GenericArg :: Lifetime ( l) => l. ident . span ,
274288 GenericArg :: Type ( t) => t. span ,
275- GenericArg :: Const ( c) => c. span ,
289+ GenericArg :: Const ( c) => c. span ( ) ,
276290 GenericArg :: Infer ( i) => i. span ,
277291 }
278292 }
@@ -281,7 +295,10 @@ impl GenericArg<'_> {
281295 match self {
282296 GenericArg :: Lifetime ( l) => l. hir_id ,
283297 GenericArg :: Type ( t) => t. hir_id ,
284- GenericArg :: Const ( c) => c. value . hir_id ,
298+ GenericArg :: Const ( c) => match c. kind {
299+ ConstArgKind :: AnonConst ( _, ct) => ct. hir_id ,
300+ ConstArgKind :: Param ( id, _) => id,
301+ } ,
285302 GenericArg :: Infer ( i) => i. hir_id ,
286303 }
287304 }
@@ -4011,7 +4028,7 @@ mod size_asserts {
40114028 static_assert_size ! ( FnDecl <' _>, 40 ) ;
40124029 static_assert_size ! ( ForeignItem <' _>, 72 ) ;
40134030 static_assert_size ! ( ForeignItemKind <' _>, 40 ) ;
4014- static_assert_size ! ( GenericArg <' _>, 32 ) ;
4031+ static_assert_size ! ( GenericArg <' _>, 16 ) ;
40154032 static_assert_size ! ( GenericBound <' _>, 48 ) ;
40164033 static_assert_size ! ( Generics <' _>, 56 ) ;
40174034 static_assert_size ! ( Impl <' _>, 80 ) ;
0 commit comments