File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Expand file tree Collapse file tree 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 {
473473 }
474474}
475475
476- fn print_inlined_const ( cx : & DocContext , did : DefId ) -> String {
476+ pub fn print_inlined_const ( cx : & DocContext , did : DefId ) -> String {
477477 let body = cx. tcx . extern_const_body ( did) ;
478478 let inlined = InlinedConst {
479479 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 {
17931793 let n = cx. tcx . const_eval ( param_env. and ( ( def_id, substs) ) ) . unwrap ( ) ;
17941794 let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
17951795 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+ }
17961802 } else {
17971803 format ! ( "{:?}" , n)
17981804 } ;
@@ -1909,6 +1915,12 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
19091915 ty:: TyArray ( ty, n) => {
19101916 let n = if let ConstVal :: Integral ( ConstInt :: Usize ( n) ) = n. val {
19111917 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+ }
19121924 } else {
19131925 format ! ( "{:?}" , n)
19141926 } ;
You can’t perform that action at this time.
0 commit comments