@@ -383,6 +383,9 @@ pub trait Visitor<'v>: Sized {
383383 fn visit_pat ( & mut self , p : & ' v Pat < ' v > ) {
384384 walk_pat ( self , p)
385385 }
386+ fn visit_array_length ( & mut self , len : & ' v ArrayLen ) {
387+ walk_array_len ( self , len)
388+ }
386389 fn visit_anon_const ( & mut self , c : & ' v AnonConst ) {
387390 walk_anon_const ( self , c)
388391 }
@@ -753,7 +756,7 @@ pub fn walk_ty<'v, V: Visitor<'v>>(visitor: &mut V, typ: &'v Ty<'v>) {
753756 }
754757 TyKind :: Array ( ref ty, ref length) => {
755758 visitor. visit_ty ( ty) ;
756- visitor. visit_anon_const ( length)
759+ visitor. visit_array_length ( length)
757760 }
758761 TyKind :: TraitObject ( bounds, ref lifetime, _syntax) => {
759762 for bound in bounds {
@@ -1124,6 +1127,13 @@ pub fn walk_stmt<'v, V: Visitor<'v>>(visitor: &mut V, statement: &'v Stmt<'v>) {
11241127 }
11251128}
11261129
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+
11271137pub fn walk_anon_const < ' v , V : Visitor < ' v > > ( visitor : & mut V , constant : & ' v AnonConst ) {
11281138 visitor. visit_id ( constant. hir_id ) ;
11291139 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>)
11471157 ExprKind :: ConstBlock ( ref anon_const) => visitor. visit_anon_const ( anon_const) ,
11481158 ExprKind :: Repeat ( ref element, ref count) => {
11491159 visitor. visit_expr ( element) ;
1150- visitor. visit_anon_const ( count)
1160+ visitor. visit_array_length ( count)
11511161 }
11521162 ExprKind :: Struct ( ref qpath, fields, ref optional_base) => {
11531163 visitor. visit_qpath ( qpath, expression. hir_id , expression. span ) ;
0 commit comments