@@ -383,6 +383,9 @@ pub trait Visitor<'v>: Sized {
383
383
fn visit_pat ( & mut self , p : & ' v Pat < ' v > ) {
384
384
walk_pat ( self , p)
385
385
}
386
+ fn visit_array_length ( & mut self , len : & ' v ArrayLen ) {
387
+ walk_array_len ( self , len)
388
+ }
386
389
fn visit_anon_const ( & mut self , c : & ' v AnonConst ) {
387
390
walk_anon_const ( self , c)
388
391
}
@@ -753,7 +756,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
753
756
}
754
757
TyKind :: Array ( ref ty, ref length) => {
755
758
visitor. visit_ty ( ty) ;
756
- visitor. visit_anon_const ( length)
759
+ visitor. visit_array_length ( length)
757
760
}
758
761
TyKind :: TraitObject ( bounds, ref lifetime, _syntax) => {
759
762
for bound in bounds {
@@ -1124,6 +1127,13 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt<'v>) {
1124
1127
}
1125
1128
}
1126
1129
1130
+ pub fn walk_array_len < ' v , V : Visitor < ' v > > ( visitor : & mut V , len : & ' v ArrayLen ) {
1131
+ match len {
1132
+ & ArrayLen :: Infer ( hir_id, _span) => visitor. visit_id ( hir_id) ,
1133
+ ArrayLen :: Body ( c) => visitor. visit_anon_const ( c) ,
1134
+ }
1135
+ }
1136
+
1127
1137
pub fn walk_anon_const < ' v , V : Visitor < ' v > > ( visitor : & mut V , constant : & ' v AnonConst ) {
1128
1138
visitor. visit_id ( constant. hir_id ) ;
1129
1139
visitor. visit_nested_body ( constant. body ) ;
@@ -1147,7 +1157,7 @@ pub fn walk_expr<'v, V: Visitor<'v>>(visitor: &mut V, expression: &'v Expr<'v>)
1147
1157
ExprKind :: ConstBlock ( ref anon_const) => visitor. visit_anon_const ( anon_const) ,
1148
1158
ExprKind :: Repeat ( ref element, ref count) => {
1149
1159
visitor. visit_expr ( element) ;
1150
- visitor. visit_anon_const ( count)
1160
+ visitor. visit_array_length ( count)
1151
1161
}
1152
1162
ExprKind :: Struct ( ref qpath, fields, ref optional_base) => {
1153
1163
visitor. visit_qpath ( qpath, expression. hir_id , expression. span ) ;
0 commit comments