@@ -1335,17 +1335,23 @@ impl Clean<Type> for hir::Ty<'_> {
1335
1335
}
1336
1336
TyKind :: Slice ( ref ty) => Slice ( box ty. clean ( cx) ) ,
1337
1337
TyKind :: Array ( ref ty, ref length) => {
1338
- let def_id = cx. tcx . hir ( ) . local_def_id ( length. hir_id ) ;
1339
- // NOTE(min_const_generics): We can't use `const_eval_poly` for constants
1340
- // as we currently do not supply the parent generics to anonymous constants
1341
- // but do allow `ConstKind::Param`.
1342
- //
1343
- // `const_eval_poly` tries to to first substitute generic parameters which
1344
- // results in an ICE while manually constructing the constant and using `eval`
1345
- // does nothing for `ConstKind::Param`.
1346
- let ct = ty:: Const :: from_anon_const ( cx. tcx , def_id) ;
1347
- let param_env = cx. tcx . param_env ( def_id) ;
1348
- let length = print_const ( cx, ct. eval ( cx. tcx , param_env) ) ;
1338
+ let length = match length {
1339
+ hir:: ArrayLen :: Infer ( _, _) => "_" . to_string ( ) ,
1340
+ hir:: ArrayLen :: Body ( anon_const) => {
1341
+ let def_id = cx. tcx . hir ( ) . local_def_id ( anon_const. hir_id ) ;
1342
+ // NOTE(min_const_generics): We can't use `const_eval_poly` for constants
1343
+ // as we currently do not supply the parent generics to anonymous constants
1344
+ // but do allow `ConstKind::Param`.
1345
+ //
1346
+ // `const_eval_poly` tries to to first substitute generic parameters which
1347
+ // results in an ICE while manually constructing the constant and using `eval`
1348
+ // does nothing for `ConstKind::Param`.
1349
+ let ct = ty:: Const :: from_anon_const ( cx. tcx , def_id) ;
1350
+ let param_env = cx. tcx . param_env ( def_id) ;
1351
+ print_const ( cx, ct. eval ( cx. tcx , param_env) )
1352
+ }
1353
+ } ;
1354
+
1349
1355
Array ( box ty. clean ( cx) , length)
1350
1356
}
1351
1357
TyKind :: Tup ( tys) => Tuple ( tys. iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ) ,
0 commit comments