@@ -1083,25 +1083,37 @@ impl Clean<TypeKind> for hir::def::DefKind {
10831083
10841084impl Clean < Item > for hir:: TraitItem < ' _ > {
10851085 fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
1086+ let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
10861087 let inner = match self . kind {
10871088 hir:: TraitItemKind :: Const ( ref ty, default) => {
10881089 AssocConstItem ( ty. clean ( cx) , default. map ( |e| print_const_expr ( cx, e) ) )
10891090 }
10901091 hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Provided ( body) ) => {
1091- MethodItem ( ( sig, & self . generics , body, None ) . clean ( cx) )
1092+ let mut m = ( sig, & self . generics , body, None ) . clean ( cx) ;
1093+ if m. header . constness == hir:: Constness :: Const
1094+ && !is_min_const_fn ( cx. tcx , local_did. to_def_id ( ) )
1095+ {
1096+ m. header . constness = hir:: Constness :: NotConst ;
1097+ }
1098+ MethodItem ( m)
10921099 }
10931100 hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( ref names) ) => {
10941101 let ( generics, decl) = enter_impl_trait ( cx, || {
10951102 ( self . generics . clean ( cx) , ( & * sig. decl , & names[ ..] ) . clean ( cx) )
10961103 } ) ;
10971104 let ( all_types, ret_types) = get_all_types ( & generics, & decl, cx) ;
1098- TyMethodItem ( TyMethod { header : sig. header , decl, generics, all_types, ret_types } )
1105+ let mut t = TyMethod { header : sig. header , decl, generics, all_types, ret_types } ;
1106+ if t. header . constness == hir:: Constness :: Const
1107+ && !is_min_const_fn ( cx. tcx , local_did. to_def_id ( ) )
1108+ {
1109+ t. header . constness = hir:: Constness :: NotConst ;
1110+ }
1111+ TyMethodItem ( t)
10991112 }
11001113 hir:: TraitItemKind :: Type ( ref bounds, ref default) => {
11011114 AssocTypeItem ( bounds. clean ( cx) , default. clean ( cx) )
11021115 }
11031116 } ;
1104- let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
11051117 Item {
11061118 name : Some ( self . ident . name . clean ( cx) ) ,
11071119 attrs : self . attrs . clean ( cx) ,
@@ -1117,20 +1129,26 @@ impl Clean<Item> for hir::TraitItem<'_> {
11171129
11181130impl Clean < Item > for hir:: ImplItem < ' _ > {
11191131 fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
1132+ let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
11201133 let inner = match self . kind {
11211134 hir:: ImplItemKind :: Const ( ref ty, expr) => {
11221135 AssocConstItem ( ty. clean ( cx) , Some ( print_const_expr ( cx, expr) ) )
11231136 }
11241137 hir:: ImplItemKind :: Fn ( ref sig, body) => {
1125- MethodItem ( ( sig, & self . generics , body, Some ( self . defaultness ) ) . clean ( cx) )
1138+ let mut m = ( sig, & self . generics , body, Some ( self . defaultness ) ) . clean ( cx) ;
1139+ if m. header . constness == hir:: Constness :: Const
1140+ && !is_min_const_fn ( cx. tcx , local_did. to_def_id ( ) )
1141+ {
1142+ m. header . constness = hir:: Constness :: NotConst ;
1143+ }
1144+ MethodItem ( m)
11261145 }
11271146 hir:: ImplItemKind :: TyAlias ( ref ty) => {
11281147 let type_ = ty. clean ( cx) ;
11291148 let item_type = type_. def_id ( ) . and_then ( |did| inline:: build_ty ( cx, did) ) ;
11301149 TypedefItem ( Typedef { type_, generics : Generics :: default ( ) , item_type } , true )
11311150 }
11321151 } ;
1133- let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
11341152 Item {
11351153 name : Some ( self . ident . name . clean ( cx) ) ,
11361154 source : self . span . clean ( cx) ,
0 commit comments