@@ -1090,25 +1090,37 @@ impl Clean<TypeKind> for hir::def::DefKind {
1090
1090
1091
1091
impl Clean < Item > for hir:: TraitItem < ' _ > {
1092
1092
fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
1093
+ let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
1093
1094
let inner = match self . kind {
1094
1095
hir:: TraitItemKind :: Const ( ref ty, default) => {
1095
1096
AssocConstItem ( ty. clean ( cx) , default. map ( |e| print_const_expr ( cx, e) ) )
1096
1097
}
1097
1098
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Provided ( body) ) => {
1098
- MethodItem ( ( sig, & self . generics , body, None ) . clean ( cx) )
1099
+ let mut m = ( sig, & self . generics , body, None ) . clean ( cx) ;
1100
+ if m. header . constness == hir:: Constness :: Const
1101
+ && !is_min_const_fn ( cx. tcx , local_did. to_def_id ( ) )
1102
+ {
1103
+ m. header . constness = hir:: Constness :: NotConst ;
1104
+ }
1105
+ MethodItem ( m)
1099
1106
}
1100
1107
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( ref names) ) => {
1101
1108
let ( generics, decl) = enter_impl_trait ( cx, || {
1102
1109
( self . generics . clean ( cx) , ( & * sig. decl , & names[ ..] ) . clean ( cx) )
1103
1110
} ) ;
1104
1111
let ( all_types, ret_types) = get_all_types ( & generics, & decl, cx) ;
1105
- TyMethodItem ( TyMethod { header : sig. header , decl, generics, all_types, ret_types } )
1112
+ let mut t = TyMethod { header : sig. header , decl, generics, all_types, ret_types } ;
1113
+ if t. header . constness == hir:: Constness :: Const
1114
+ && !is_min_const_fn ( cx. tcx , local_did. to_def_id ( ) )
1115
+ {
1116
+ t. header . constness = hir:: Constness :: NotConst ;
1117
+ }
1118
+ TyMethodItem ( t)
1106
1119
}
1107
1120
hir:: TraitItemKind :: Type ( ref bounds, ref default) => {
1108
1121
AssocTypeItem ( bounds. clean ( cx) , default. clean ( cx) )
1109
1122
}
1110
1123
} ;
1111
- let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
1112
1124
Item {
1113
1125
name : Some ( self . ident . name . clean ( cx) ) ,
1114
1126
attrs : self . attrs . clean ( cx) ,
@@ -1124,20 +1136,26 @@ impl Clean<Item> for hir::TraitItem<'_> {
1124
1136
1125
1137
impl Clean < Item > for hir:: ImplItem < ' _ > {
1126
1138
fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
1139
+ let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
1127
1140
let inner = match self . kind {
1128
1141
hir:: ImplItemKind :: Const ( ref ty, expr) => {
1129
1142
AssocConstItem ( ty. clean ( cx) , Some ( print_const_expr ( cx, expr) ) )
1130
1143
}
1131
1144
hir:: ImplItemKind :: Fn ( ref sig, body) => {
1132
- MethodItem ( ( sig, & self . generics , body, Some ( self . defaultness ) ) . clean ( cx) )
1145
+ let mut m = ( sig, & self . generics , body, Some ( self . defaultness ) ) . clean ( cx) ;
1146
+ if m. header . constness == hir:: Constness :: Const
1147
+ && !is_min_const_fn ( cx. tcx , local_did. to_def_id ( ) )
1148
+ {
1149
+ m. header . constness = hir:: Constness :: NotConst ;
1150
+ }
1151
+ MethodItem ( m)
1133
1152
}
1134
1153
hir:: ImplItemKind :: TyAlias ( ref ty) => {
1135
1154
let type_ = ty. clean ( cx) ;
1136
1155
let item_type = type_. def_id ( ) . and_then ( |did| inline:: build_ty ( cx, did) ) ;
1137
1156
TypedefItem ( Typedef { type_, generics : Generics :: default ( ) , item_type } , true )
1138
1157
}
1139
1158
} ;
1140
- let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
1141
1159
Item {
1142
1160
name : Some ( self . ident . name . clean ( cx) ) ,
1143
1161
source : self . span . clean ( cx) ,
0 commit comments