Skip to content

Commit 77733ba

Browse files
committed
fix rustdoc
1 parent e3f5cc6 commit 77733ba

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/librustdoc/clean/mod.rs

+17-11
Original file line numberDiff line numberDiff line change
@@ -1335,17 +1335,23 @@ impl Clean<Type> for hir::Ty<'_> {
13351335
}
13361336
TyKind::Slice(ref ty) => Slice(box ty.clean(cx)),
13371337
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+
13491355
Array(box ty.clean(cx), length)
13501356
}
13511357
TyKind::Tup(tys) => Tuple(tys.iter().map(|x| x.clean(cx)).collect()),

0 commit comments

Comments
 (0)