@@ -33,7 +33,6 @@ use rustc::middle::resolve_lifetime as rl;
33
33
use rustc:: middle:: lang_items;
34
34
use rustc:: hir:: def:: { Def , CtorKind } ;
35
35
use rustc:: hir:: def_id:: { CrateNum , DefId , CRATE_DEF_INDEX , LOCAL_CRATE } ;
36
- use rustc:: traits:: Reveal ;
37
36
use rustc:: ty:: subst:: Substs ;
38
37
use rustc:: ty:: { self , Ty , AdtKind } ;
39
38
use rustc:: middle:: stability;
@@ -2062,7 +2061,7 @@ impl Clean<Type> for hir::Ty {
2062
2061
TySlice ( ref ty) => Slice ( box ty. clean ( cx) ) ,
2063
2062
TyArray ( ref ty, n) => {
2064
2063
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 ) ;
2066
2065
let substs = Substs :: identity_for_item ( cx. tcx , def_id) ;
2067
2066
let n = cx. tcx . const_eval ( param_env. and ( ( def_id, substs) ) ) . unwrap ( ) ;
2068
2067
let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
@@ -2191,6 +2190,11 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
2191
2190
ty:: TyStr => Primitive ( PrimitiveType :: Str ) ,
2192
2191
ty:: TySlice ( ty) => Slice ( box ty. clean ( cx) ) ,
2193
2192
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
+ } ;
2194
2198
let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
2195
2199
n. to_string ( )
2196
2200
} else if let ConstVal :: Unevaluated ( def_id, _) = n. val {
0 commit comments