@@ -259,13 +259,13 @@ fn clean_lifetime<'tcx>(lifetime: &hir::Lifetime, cx: &mut DocContext<'tcx>) ->
259259pub ( crate ) fn clean_const < ' tcx > ( constant : & hir:: ConstArg , cx : & mut DocContext < ' tcx > ) -> Constant {
260260 let def_id = cx. tcx . hir ( ) . body_owner_def_id ( constant. value . body ) . to_def_id ( ) ;
261261 Constant {
262- type_ : clean_middle_ty (
262+ type_ : Box :: new ( clean_middle_ty (
263263 ty:: Binder :: dummy ( cx. tcx . type_of ( def_id) . instantiate_identity ( ) ) ,
264264 cx,
265265 Some ( def_id) ,
266266 None ,
267- ) ,
268- generics : Box :: new ( Generics :: default ( ) ) ,
267+ ) ) ,
268+ generics : Generics :: default ( ) ,
269269 kind : ConstantKind :: Anonymous { body : constant. value . body } ,
270270 }
271271}
@@ -276,8 +276,8 @@ pub(crate) fn clean_middle_const<'tcx>(
276276) -> Constant {
277277 // FIXME: instead of storing the stringified expression, store `self` directly instead.
278278 Constant {
279- type_ : clean_middle_ty ( constant. map_bound ( |c| c. ty ( ) ) , cx, None , None ) ,
280- generics : Box :: new ( Generics :: default ( ) ) ,
279+ type_ : Box :: new ( clean_middle_ty ( constant. map_bound ( |c| c. ty ( ) ) , cx, None , None ) ) ,
280+ generics : Generics :: default ( ) ,
281281 kind : ConstantKind :: TyConst { expr : constant. skip_binder ( ) . to_string ( ) . into ( ) } ,
282282 }
283283}
@@ -1216,14 +1216,14 @@ fn clean_trait_item<'tcx>(trait_item: &hir::TraitItem<'tcx>, cx: &mut DocContext
12161216 hir:: TraitItemKind :: Const ( ty, Some ( default) ) => {
12171217 let generics = enter_impl_trait ( cx, |cx| clean_generics ( trait_item. generics , cx) ) ;
12181218 AssocConstItem (
1219- Box :: new ( generics) ,
1220- clean_ty ( ty, cx) ,
1219+ generics,
1220+ Box :: new ( clean_ty ( ty, cx) ) ,
12211221 ConstantKind :: Local { def_id : local_did, body : default } ,
12221222 )
12231223 }
12241224 hir:: TraitItemKind :: Const ( ty, None ) => {
12251225 let generics = enter_impl_trait ( cx, |cx| clean_generics ( trait_item. generics , cx) ) ;
1226- TyAssocConstItem ( Box :: new ( generics ) , clean_ty ( ty, cx) )
1226+ TyAssocConstItem ( generics , Box :: new ( clean_ty ( ty, cx) ) )
12271227 }
12281228 hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Provided ( body) ) => {
12291229 let m = clean_function ( cx, sig, trait_item. generics , FunctionArgs :: Body ( body) ) ;
@@ -1272,7 +1272,7 @@ pub(crate) fn clean_impl_item<'tcx>(
12721272 hir:: ImplItemKind :: Const ( ty, expr) => {
12731273 let generics = clean_generics ( impl_. generics , cx) ;
12741274 let default = ConstantKind :: Local { def_id : local_did, body : expr } ;
1275- AssocConstItem ( Box :: new ( generics ) , clean_ty ( ty, cx) , default)
1275+ AssocConstItem ( generics , Box :: new ( clean_ty ( ty, cx) ) , default)
12761276 }
12771277 hir:: ImplItemKind :: Fn ( ref sig, body) => {
12781278 let m = clean_function ( cx, sig, impl_. generics , FunctionArgs :: Body ( body) ) ;
@@ -1311,18 +1311,18 @@ pub(crate) fn clean_middle_assoc_item<'tcx>(
13111311 let tcx = cx. tcx ;
13121312 let kind = match assoc_item. kind {
13131313 ty:: AssocKind :: Const => {
1314- let ty = clean_middle_ty (
1314+ let ty = Box :: new ( clean_middle_ty (
13151315 ty:: Binder :: dummy ( tcx. type_of ( assoc_item. def_id ) . instantiate_identity ( ) ) ,
13161316 cx,
13171317 Some ( assoc_item. def_id ) ,
13181318 None ,
1319- ) ;
1319+ ) ) ;
13201320
1321- let mut generics = Box :: new ( clean_ty_generics (
1321+ let mut generics = clean_ty_generics (
13221322 cx,
13231323 tcx. generics_of ( assoc_item. def_id ) ,
13241324 tcx. explicit_predicates_of ( assoc_item. def_id ) ,
1325- ) ) ;
1325+ ) ;
13261326 simplify:: move_bounds_to_generic_parameters ( & mut generics) ;
13271327
13281328 let provided = match assoc_item. container {
@@ -2718,8 +2718,8 @@ fn clean_maybe_renamed_item<'tcx>(
27182718 StaticItem ( Static { type_ : clean_ty ( ty, cx) , mutability, expr : Some ( body_id) } )
27192719 }
27202720 ItemKind :: Const ( ty, generics, body_id) => ConstantItem ( Constant {
2721- type_ : clean_ty ( ty, cx) ,
2722- generics : Box :: new ( clean_generics ( generics, cx) ) ,
2721+ type_ : Box :: new ( clean_ty ( ty, cx) ) ,
2722+ generics : clean_generics ( generics, cx) ,
27232723 kind : ConstantKind :: Local { body : body_id, def_id } ,
27242724 } ) ,
27252725 ItemKind :: OpaqueTy ( ref ty) => OpaqueTyItem ( OpaqueTy {
0 commit comments