@@ -494,6 +494,7 @@ impl<'hir, Unambig> ConstArg<'hir, Unambig> {
494494
495495 pub fn span ( & self ) -> Span {
496496 match self . kind {
497+ ConstArgKind :: Struct ( path, _) => path. span ( ) ,
497498 ConstArgKind :: Path ( path) => path. span ( ) ,
498499 ConstArgKind :: Anon ( anon) => anon. span ,
499500 ConstArgKind :: Error ( span, _) => span,
@@ -513,13 +514,23 @@ pub enum ConstArgKind<'hir, Unambig = ()> {
513514 /// However, in the future, we'll be using it for all of those.
514515 Path ( QPath < ' hir > ) ,
515516 Anon ( & ' hir AnonConst ) ,
517+ /// Represents construction of struct/struct variants
518+ Struct ( QPath < ' hir > , & ' hir [ & ' hir ConstArgExprField < ' hir > ] ) ,
516519 /// Error const
517520 Error ( Span , ErrorGuaranteed ) ,
518521 /// This variant is not always used to represent inference consts, sometimes
519522 /// [`GenericArg::Infer`] is used instead.
520523 Infer ( Span , Unambig ) ,
521524}
522525
526+ #[ derive( Clone , Copy , Debug , HashStable_Generic ) ]
527+ pub struct ConstArgExprField < ' hir > {
528+ pub hir_id : HirId ,
529+ pub span : Span ,
530+ pub field : Ident ,
531+ pub expr : & ' hir ConstArg < ' hir > ,
532+ }
533+
523534#[ derive( Clone , Copy , Debug , HashStable_Generic ) ]
524535pub struct InferArg {
525536 #[ stable_hasher( ignore) ]
@@ -4644,6 +4655,7 @@ pub enum Node<'hir> {
46444655 ConstArg ( & ' hir ConstArg < ' hir > ) ,
46454656 Expr ( & ' hir Expr < ' hir > ) ,
46464657 ExprField ( & ' hir ExprField < ' hir > ) ,
4658+ ConstArgExprField ( & ' hir ConstArgExprField < ' hir > ) ,
46474659 Stmt ( & ' hir Stmt < ' hir > ) ,
46484660 PathSegment ( & ' hir PathSegment < ' hir > ) ,
46494661 Ty ( & ' hir Ty < ' hir > ) ,
@@ -4703,6 +4715,7 @@ impl<'hir> Node<'hir> {
47034715 Node :: AssocItemConstraint ( c) => Some ( c. ident ) ,
47044716 Node :: PatField ( f) => Some ( f. ident ) ,
47054717 Node :: ExprField ( f) => Some ( f. ident ) ,
4718+ Node :: ConstArgExprField ( f) => Some ( f. field ) ,
47064719 Node :: PreciseCapturingNonLifetimeArg ( a) => Some ( a. ident ) ,
47074720 Node :: Param ( ..)
47084721 | Node :: AnonConst ( ..)
0 commit comments