@@ -763,6 +763,7 @@ impl EffectExpr {
763763 pub fn try_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ try] ) }
764764 pub fn unsafe_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ unsafe ] ) }
765765 pub fn async_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ async ] ) }
766+ pub fn const_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ const ] ) }
766767 pub fn block_expr ( & self ) -> Option < BlockExpr > { support:: child ( & self . syntax ) }
767768}
768769#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
@@ -1251,6 +1252,14 @@ impl TupleStructPat {
12511252 pub fn r_paren_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ ')' ] ) }
12521253}
12531254#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
1255+ pub struct ConstBlockPat {
1256+ pub ( crate ) syntax : SyntaxNode ,
1257+ }
1258+ impl ConstBlockPat {
1259+ pub fn const_token ( & self ) -> Option < SyntaxToken > { support:: token ( & self . syntax , T ! [ const ] ) }
1260+ pub fn block_expr ( & self ) -> Option < BlockExpr > { support:: child ( & self . syntax ) }
1261+ }
1262+ #[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
12541263pub struct RecordPatFieldList {
12551264 pub ( crate ) syntax : SyntaxNode ,
12561265}
@@ -1369,6 +1378,7 @@ pub enum Pat {
13691378 SlicePat ( SlicePat ) ,
13701379 TuplePat ( TuplePat ) ,
13711380 TupleStructPat ( TupleStructPat ) ,
1381+ ConstBlockPat ( ConstBlockPat ) ,
13721382}
13731383#[ derive( Debug , Clone , PartialEq , Eq , Hash ) ]
13741384pub enum FieldList {
@@ -2772,6 +2782,17 @@ impl AstNode for TupleStructPat {
27722782 }
27732783 fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
27742784}
2785+ impl AstNode for ConstBlockPat {
2786+ fn can_cast ( kind : SyntaxKind ) -> bool { kind == CONST_BLOCK_PAT }
2787+ fn cast ( syntax : SyntaxNode ) -> Option < Self > {
2788+ if Self :: can_cast ( syntax. kind ( ) ) {
2789+ Some ( Self { syntax } )
2790+ } else {
2791+ None
2792+ }
2793+ }
2794+ fn syntax ( & self ) -> & SyntaxNode { & self . syntax }
2795+ }
27752796impl AstNode for RecordPatFieldList {
27762797 fn can_cast ( kind : SyntaxKind ) -> bool { kind == RECORD_PAT_FIELD_LIST }
27772798 fn cast ( syntax : SyntaxNode ) -> Option < Self > {
@@ -3242,12 +3263,15 @@ impl From<TuplePat> for Pat {
32423263impl From < TupleStructPat > for Pat {
32433264 fn from ( node : TupleStructPat ) -> Pat { Pat :: TupleStructPat ( node) }
32443265}
3266+ impl From < ConstBlockPat > for Pat {
3267+ fn from ( node : ConstBlockPat ) -> Pat { Pat :: ConstBlockPat ( node) }
3268+ }
32453269impl AstNode for Pat {
32463270 fn can_cast ( kind : SyntaxKind ) -> bool {
32473271 match kind {
32483272 IDENT_PAT | BOX_PAT | REST_PAT | LITERAL_PAT | MACRO_PAT | OR_PAT | PAREN_PAT
32493273 | PATH_PAT | WILDCARD_PAT | RANGE_PAT | RECORD_PAT | REF_PAT | SLICE_PAT
3250- | TUPLE_PAT | TUPLE_STRUCT_PAT => true ,
3274+ | TUPLE_PAT | TUPLE_STRUCT_PAT | CONST_BLOCK_PAT => true ,
32513275 _ => false ,
32523276 }
32533277 }
@@ -3268,6 +3292,7 @@ impl AstNode for Pat {
32683292 SLICE_PAT => Pat :: SlicePat ( SlicePat { syntax } ) ,
32693293 TUPLE_PAT => Pat :: TuplePat ( TuplePat { syntax } ) ,
32703294 TUPLE_STRUCT_PAT => Pat :: TupleStructPat ( TupleStructPat { syntax } ) ,
3295+ CONST_BLOCK_PAT => Pat :: ConstBlockPat ( ConstBlockPat { syntax } ) ,
32713296 _ => return None ,
32723297 } ;
32733298 Some ( res)
@@ -3289,6 +3314,7 @@ impl AstNode for Pat {
32893314 Pat :: SlicePat ( it) => & it. syntax ,
32903315 Pat :: TuplePat ( it) => & it. syntax ,
32913316 Pat :: TupleStructPat ( it) => & it. syntax ,
3317+ Pat :: ConstBlockPat ( it) => & it. syntax ,
32923318 }
32933319 }
32943320}
@@ -4137,6 +4163,11 @@ impl std::fmt::Display for TupleStructPat {
41374163 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
41384164 }
41394165}
4166+ impl std:: fmt:: Display for ConstBlockPat {
4167+ fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
4168+ std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
4169+ }
4170+ }
41404171impl std:: fmt:: Display for RecordPatFieldList {
41414172 fn fmt ( & self , f : & mut std:: fmt:: Formatter < ' _ > ) -> std:: fmt:: Result {
41424173 std:: fmt:: Display :: fmt ( self . syntax ( ) , f)
0 commit comments