@@ -1819,17 +1819,26 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
18191819 TyKind :: Array ( ty, ref length) => {
18201820 let length = match length {
18211821 hir:: ArrayLen :: Infer ( ..) => "_" . to_string ( ) ,
1822- hir:: ArrayLen :: Body ( anon_const ) => {
1822+ hir:: ArrayLen :: Body ( const_arg ) => {
18231823 // NOTE(min_const_generics): We can't use `const_eval_poly` for constants
18241824 // as we currently do not supply the parent generics to anonymous constants
18251825 // but do allow `ConstKind::Param`.
18261826 //
18271827 // `const_eval_poly` tries to first substitute generic parameters which
18281828 // results in an ICE while manually constructing the constant and using `eval`
18291829 // does nothing for `ConstKind::Param`.
1830- let ct = ty:: Const :: from_anon_const ( cx. tcx , anon_const. def_id ) ;
1831- let param_env = cx. tcx . param_env ( anon_const. def_id ) ;
1832- print_const ( cx, ct. normalize ( cx. tcx , param_env) )
1830+ let ct = ty:: Const :: from_const_arg_without_feeding ( cx. tcx , const_arg) ;
1831+ let ct = if let hir:: ConstArgKind :: Anon ( hir:: AnonConst { def_id, .. } ) =
1832+ const_arg. kind
1833+ {
1834+ // Only anon consts can implicitly capture params.
1835+ // FIXME: is this correct behavior?
1836+ let param_env = cx. tcx . param_env ( * def_id) ;
1837+ ct. normalize ( cx. tcx , param_env)
1838+ } else {
1839+ ct
1840+ } ;
1841+ print_const ( cx, ct)
18331842 }
18341843 } ;
18351844
0 commit comments