File tree 2 files changed +13
-1
lines changed
2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -473,7 +473,7 @@ impl hir::print::PpAnn for InlinedConst {
473
473
}
474
474
}
475
475
476
- fn print_inlined_const ( cx : & DocContext , did : DefId ) -> String {
476
+ pub fn print_inlined_const ( cx : & DocContext , did : DefId ) -> String {
477
477
let body = cx. tcx . extern_const_body ( did) ;
478
478
let inlined = InlinedConst {
479
479
nested_bodies : cx. tcx . item_body_nested_bodies ( did)
Original file line number Diff line number Diff line change @@ -1793,6 +1793,12 @@ impl Clean<Type> for hir::Ty {
1793
1793
let n = cx. tcx . const_eval ( param_env. and ( ( def_id, substs) ) ) . unwrap ( ) ;
1794
1794
let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
1795
1795
n. to_string ( )
1796
+ } else if let ConstVal :: Unevaluated ( def_id, _) = n. val {
1797
+ if let Some ( node_id) = cx. tcx . hir . as_local_node_id ( def_id) {
1798
+ print_const_expr ( cx, cx. tcx . hir . body_owned_by ( node_id) )
1799
+ } else {
1800
+ inline:: print_inlined_const ( cx, def_id)
1801
+ }
1796
1802
} else {
1797
1803
format ! ( "{:?}" , n)
1798
1804
} ;
@@ -1909,6 +1915,12 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
1909
1915
ty:: TyArray ( ty, n) => {
1910
1916
let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
1911
1917
n. to_string ( )
1918
+ } else if let ConstVal :: Unevaluated ( def_id, _) = n. val {
1919
+ if let Some ( node_id) = cx. tcx . hir . as_local_node_id ( def_id) {
1920
+ print_const_expr ( cx, cx. tcx . hir . body_owned_by ( node_id) )
1921
+ } else {
1922
+ inline:: print_inlined_const ( cx, def_id)
1923
+ }
1912
1924
} else {
1913
1925
format ! ( "{:?}" , n)
1914
1926
} ;
You can’t perform that action at this time.
0 commit comments