@@ -43,7 +43,7 @@ use rustc_hir::PredicateOrigin;
4343use rustc_hir:: def:: { CtorKind , DefKind , Res } ;
4444use rustc_hir:: def_id:: { DefId , DefIdMap , DefIdSet , LOCAL_CRATE , LocalDefId } ;
4545use rustc_hir_analysis:: hir_ty_lowering:: FeedConstTy ;
46- use rustc_hir_analysis:: { lower_const_arg , lower_ty} ;
46+ use rustc_hir_analysis:: { lower_const_arg_for_rustdoc , lower_ty} ;
4747use rustc_middle:: metadata:: Reexport ;
4848use rustc_middle:: middle:: resolve_bound_vars as rbv;
4949use rustc_middle:: ty:: { self , AdtKind , GenericArgsRef , Ty , TyCtxt , TypeVisitableExt , TypingMode } ;
@@ -437,7 +437,7 @@ fn clean_hir_term<'tcx>(term: &hir::Term<'tcx>, cx: &mut DocContext<'tcx>) -> Te
437437 match term {
438438 hir:: Term :: Ty ( ty) => Term :: Type ( clean_ty ( ty, cx) ) ,
439439 hir:: Term :: Const ( c) => {
440- let ct = lower_const_arg ( cx. tcx , c, FeedConstTy :: No ) ;
440+ let ct = lower_const_arg_for_rustdoc ( cx. tcx , c, FeedConstTy :: No ) ;
441441 Term :: Constant ( clean_middle_const ( ty:: Binder :: dummy ( ct) , cx) )
442442 }
443443 }
@@ -625,8 +625,9 @@ fn clean_generic_param<'tcx>(
625625 hir:: GenericParamKind :: Const { ty, default, synthetic } => {
626626 ( param. name . ident ( ) . name , GenericParamDefKind :: Const {
627627 ty : Box :: new ( clean_ty ( ty, cx) ) ,
628- default : default
629- . map ( |ct| Box :: new ( lower_const_arg ( cx. tcx , ct, FeedConstTy :: No ) . to_string ( ) ) ) ,
628+ default : default. map ( |ct| {
629+ Box :: new ( lower_const_arg_for_rustdoc ( cx. tcx , ct, FeedConstTy :: No ) . to_string ( ) )
630+ } ) ,
630631 synthetic,
631632 } )
632633 }
@@ -1813,7 +1814,7 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
18131814 // `const_eval_poly` tries to first substitute generic parameters which
18141815 // results in an ICE while manually constructing the constant and using `eval`
18151816 // does nothing for `ConstKind::Param`.
1816- let ct = lower_const_arg ( cx. tcx , const_arg, FeedConstTy :: No ) ;
1817+ let ct = lower_const_arg_for_rustdoc ( cx. tcx , const_arg, FeedConstTy :: No ) ;
18171818 let ct = if let hir:: ConstArgKind :: Anon ( hir:: AnonConst { def_id, .. } ) =
18181819 const_arg. kind
18191820 {
0 commit comments