@@ -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;
@@ -2044,7 +2043,7 @@ impl Clean<Type> for hir::Ty {
2044
2043
TySlice ( ref ty) => Slice ( box ty. clean ( cx) ) ,
2045
2044
TyArray ( ref ty, n) => {
2046
2045
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 ) ;
2048
2047
let substs = Substs :: identity_for_item ( cx. tcx , def_id) ;
2049
2048
let n = cx. tcx . const_eval ( param_env. and ( ( def_id, substs) ) ) . unwrap ( ) ;
2050
2049
let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
@@ -2173,6 +2172,11 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
2173
2172
ty:: TyStr => Primitive ( PrimitiveType :: Str ) ,
2174
2173
ty:: TySlice ( ty) => Slice ( box ty. clean ( cx) ) ,
2175
2174
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
+ } ;
2176
2180
let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
2177
2181
n. to_string ( )
2178
2182
} else if let ConstVal :: Unevaluated ( def_id, _) = n. val {
0 commit comments