@@ -1083,25 +1083,37 @@ impl Clean<TypeKind> for hir::def::DefKind {
1083
1083
1084
1084
impl Clean < Item > for hir:: TraitItem < ' _ > {
1085
1085
fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
1086
+ let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
1086
1087
let inner = match self . kind {
1087
1088
hir:: TraitItemKind :: Const ( ref ty, default) => {
1088
1089
AssocConstItem ( ty. clean ( cx) , default. map ( |e| print_const_expr ( cx, e) ) )
1089
1090
}
1090
1091
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)
1092
1099
}
1093
1100
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( ref names) ) => {
1094
1101
let ( generics, decl) = enter_impl_trait ( cx, || {
1095
1102
( self . generics . clean ( cx) , ( & * sig. decl , & names[ ..] ) . clean ( cx) )
1096
1103
} ) ;
1097
1104
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)
1099
1112
}
1100
1113
hir:: TraitItemKind :: Type ( ref bounds, ref default) => {
1101
1114
AssocTypeItem ( bounds. clean ( cx) , default. clean ( cx) )
1102
1115
}
1103
1116
} ;
1104
- let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
1105
1117
Item {
1106
1118
name : Some ( self . ident . name . clean ( cx) ) ,
1107
1119
attrs : self . attrs . clean ( cx) ,
@@ -1117,20 +1129,26 @@ impl Clean<Item> for hir::TraitItem<'_> {
1117
1129
1118
1130
impl Clean < Item > for hir:: ImplItem < ' _ > {
1119
1131
fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
1132
+ let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
1120
1133
let inner = match self . kind {
1121
1134
hir:: ImplItemKind :: Const ( ref ty, expr) => {
1122
1135
AssocConstItem ( ty. clean ( cx) , Some ( print_const_expr ( cx, expr) ) )
1123
1136
}
1124
1137
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)
1126
1145
}
1127
1146
hir:: ImplItemKind :: TyAlias ( ref ty) => {
1128
1147
let type_ = ty. clean ( cx) ;
1129
1148
let item_type = type_. def_id ( ) . and_then ( |did| inline:: build_ty ( cx, did) ) ;
1130
1149
TypedefItem ( Typedef { type_, generics : Generics :: default ( ) , item_type } , true )
1131
1150
}
1132
1151
} ;
1133
- let local_did = cx. tcx . hir ( ) . local_def_id ( self . hir_id ) ;
1134
1152
Item {
1135
1153
name : Some ( self . ident . name . clean ( cx) ) ,
1136
1154
source : self . span . clean ( cx) ,
0 commit comments