@@ -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;
@@ -2044,7 +2043,7 @@ impl Clean<Type> for hir::Ty {
20442043 TySlice ( ref ty) => Slice ( box ty. clean ( cx) ) ,
20452044 TyArray ( ref ty, n) => {
20462045 let def_id = cx. tcx . hir . body_owner_def_id ( n) ;
2047- let param_env = ty :: ParamEnv :: empty ( Reveal :: UserFacing ) ;
2046+ let param_env = cx . tcx . param_env ( def_id ) ;
20482047 let substs = Substs :: identity_for_item ( cx. tcx , def_id) ;
20492048 let n = cx. tcx . const_eval ( param_env. and ( ( def_id, substs) ) ) . unwrap ( ) ;
20502049 let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
@@ -2173,6 +2172,11 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
21732172 ty:: TyStr => Primitive ( PrimitiveType :: Str ) ,
21742173 ty:: TySlice ( ty) => Slice ( box ty. clean ( cx) ) ,
21752174 ty:: TyArray ( ty, n) => {
2175+ let mut n = cx. tcx . lift ( & n) . unwrap ( ) ;
2176+ if let ConstVal :: Unevaluated ( def_id, substs) = n. val {
2177+ let param_env = cx. tcx . param_env ( def_id) ;
2178+ n = cx. tcx . const_eval ( param_env. and ( ( def_id, substs) ) ) . unwrap ( )
2179+ } ;
21762180 let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
21772181 n. to_string ( )
21782182 } else if let ConstVal :: Unevaluated ( def_id, _) = n. val {
0 commit comments