@@ -563,6 +563,7 @@ impl Pat {
563
563
/// This is intended for use by diagnostics.
564
564
pub fn to_ty ( & self ) -> Option < P < Ty > > {
565
565
let kind = match & self . kind {
566
+ PatKind :: Missing => unreachable ! ( ) ,
566
567
// In a type expression `_` is an inference variable.
567
568
PatKind :: Wild => TyKind :: Infer ,
568
569
// An IDENT pattern with no binding mode would be valid as path to a type. E.g. `u32`.
@@ -625,7 +626,8 @@ impl Pat {
625
626
| PatKind :: Guard ( s, _) => s. walk ( it) ,
626
627
627
628
// These patterns do not contain subpatterns, skip.
628
- PatKind :: Wild
629
+ PatKind :: Missing
630
+ | PatKind :: Wild
629
631
| PatKind :: Rest
630
632
| PatKind :: Never
631
633
| PatKind :: Expr ( _)
@@ -676,6 +678,7 @@ impl Pat {
676
678
/// Return a name suitable for diagnostics.
677
679
pub fn descr ( & self ) -> Option < String > {
678
680
match & self . kind {
681
+ PatKind :: Missing => unreachable ! ( ) ,
679
682
PatKind :: Wild => Some ( "_" . to_string ( ) ) ,
680
683
PatKind :: Ident ( BindingMode :: NONE , ident, None ) => Some ( format ! ( "{ident}" ) ) ,
681
684
PatKind :: Ref ( pat, mutbl) => pat. descr ( ) . map ( |d| format ! ( "&{}{d}" , mutbl. prefix_str( ) ) ) ,
@@ -769,6 +772,9 @@ pub enum RangeSyntax {
769
772
// Adding a new variant? Please update `test_pat` in `tests/ui/macros/stringify.rs`.
770
773
#[ derive( Clone , Encodable , Decodable , Debug ) ]
771
774
pub enum PatKind {
775
+ /// A missing pattern, e.g. for an anonymous param in a bare fn like `fn f(u32)`.
776
+ Missing ,
777
+
772
778
/// Represents a wildcard pattern (`_`).
773
779
Wild ,
774
780
@@ -1169,6 +1175,7 @@ pub enum MacStmtStyle {
1169
1175
#[ derive( Clone , Encodable , Decodable , Debug ) ]
1170
1176
pub struct Local {
1171
1177
pub id : NodeId ,
1178
+ pub super_ : Option < Span > ,
1172
1179
pub pat : P < Pat > ,
1173
1180
pub ty : Option < P < Ty > > ,
1174
1181
pub kind : LocalKind ,
@@ -3926,7 +3933,7 @@ mod size_asserts {
3926
3933
static_assert_size ! ( Item , 144 ) ;
3927
3934
static_assert_size ! ( ItemKind , 80 ) ;
3928
3935
static_assert_size ! ( LitKind , 24 ) ;
3929
- static_assert_size ! ( Local , 80 ) ;
3936
+ static_assert_size ! ( Local , 96 ) ;
3930
3937
static_assert_size ! ( MetaItemLit , 40 ) ;
3931
3938
static_assert_size ! ( Param , 40 ) ;
3932
3939
static_assert_size ! ( Pat , 72 ) ;
0 commit comments