@@ -33,7 +33,6 @@ use rustc::middle::resolve_lifetime as rl;
3333use rustc:: middle:: lang_items;
3434use rustc:: hir:: def:: { Def , CtorKind } ;
3535use rustc:: hir:: def_id:: { CrateNum , DefId , CRATE_DEF_INDEX , LOCAL_CRATE } ;
36- use rustc:: traits:: Reveal ;
3736use rustc:: ty:: subst:: Substs ;
3837use rustc:: ty:: { self , Ty , AdtKind } ;
3938use rustc:: middle:: stability;
@@ -2062,7 +2061,7 @@ impl Clean<Type> for hir::Ty {
20622061 TySlice ( ref ty) => Slice ( box ty. clean ( cx) ) ,
20632062 TyArray ( ref ty, n) => {
20642063 let def_id = cx. tcx . hir . body_owner_def_id ( n) ;
2065- let param_env = ty :: ParamEnv :: empty ( Reveal :: UserFacing ) ;
2064+ let param_env = cx . tcx . param_env ( def_id ) ;
20662065 let substs = Substs :: identity_for_item ( cx. tcx , def_id) ;
20672066 let n = cx. tcx . const_eval ( param_env. and ( ( def_id, substs) ) ) . unwrap ( ) ;
20682067 let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
@@ -2191,6 +2190,11 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
21912190 ty:: TyStr => Primitive ( PrimitiveType :: Str ) ,
21922191 ty:: TySlice ( ty) => Slice ( box ty. clean ( cx) ) ,
21932192 ty:: TyArray ( ty, n) => {
2193+ let mut n = cx. tcx . lift ( & n) . unwrap ( ) ;
2194+ if let ConstVal :: Unevaluated ( def_id, substs) = n. val {
2195+ let param_env = cx. tcx . param_env ( def_id) ;
2196+ n = cx. tcx . const_eval ( param_env. and ( ( def_id, substs) ) ) . unwrap ( )
2197+ } ;
21942198 let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
21952199 n. to_string ( )
21962200 } else if let ConstVal :: Unevaluated ( def_id, _) = n. val {
0 commit comments