@@ -908,15 +908,15 @@ fn clean_function<'tcx>(
908908 sig : & hir:: FnSig < ' tcx > ,
909909 generics : & hir:: Generics < ' tcx > ,
910910 body_id : hir:: BodyId ,
911- ) -> Function {
911+ ) -> Box < Function > {
912912 let ( generics, decl) = enter_impl_trait ( cx, |cx| {
913913 // NOTE: generics must be cleaned before args
914914 let generics = generics. clean ( cx) ;
915915 let args = clean_args_from_types_and_body_id ( cx, sig. decl . inputs , body_id) ;
916916 let decl = clean_fn_decl_with_args ( cx, sig. decl , args) ;
917917 ( generics, decl)
918918 } ) ;
919- Function { decl, generics }
919+ Box :: new ( Function { decl, generics } )
920920}
921921
922922fn clean_args_from_types_and_names < ' tcx > (
@@ -1061,18 +1061,18 @@ impl<'tcx> Clean<'tcx, Item> for hir::TraitItem<'tcx> {
10611061 let decl = clean_fn_decl_with_args ( cx, sig. decl , args) ;
10621062 ( generics, decl)
10631063 } ) ;
1064- TyMethodItem ( Function { decl, generics } )
1064+ TyMethodItem ( Box :: new ( Function { decl, generics } ) )
10651065 }
10661066 hir:: TraitItemKind :: Type ( bounds, Some ( default) ) => {
10671067 let generics = enter_impl_trait ( cx, |cx| self . generics . clean ( cx) ) ;
10681068 let bounds = bounds. iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ;
10691069 let item_type = clean_middle_ty ( hir_ty_to_ty ( cx. tcx , default) , cx, None ) ;
10701070 AssocTypeItem (
1071- Typedef {
1071+ Box :: new ( Typedef {
10721072 type_ : clean_ty ( default, cx) ,
10731073 generics,
10741074 item_type : Some ( item_type) ,
1075- } ,
1075+ } ) ,
10761076 bounds,
10771077 )
10781078 }
@@ -1109,7 +1109,7 @@ impl<'tcx> Clean<'tcx, Item> for hir::ImplItem<'tcx> {
11091109 let generics = self . generics . clean ( cx) ;
11101110 let item_type = clean_middle_ty ( hir_ty_to_ty ( cx. tcx , hir_ty) , cx, None ) ;
11111111 AssocTypeItem (
1112- Typedef { type_, generics, item_type : Some ( item_type) } ,
1112+ Box :: new ( Typedef { type_, generics, item_type : Some ( item_type) } ) ,
11131113 Vec :: new ( ) ,
11141114 )
11151115 }
@@ -1186,9 +1186,9 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem {
11861186 ty:: ImplContainer ( _) => Some ( self . defaultness ) ,
11871187 ty:: TraitContainer ( _) => None ,
11881188 } ;
1189- MethodItem ( Function { generics, decl } , defaultness)
1189+ MethodItem ( Box :: new ( Function { generics, decl } ) , defaultness)
11901190 } else {
1191- TyMethodItem ( Function { generics, decl } )
1191+ TyMethodItem ( Box :: new ( Function { generics, decl } ) )
11921192 }
11931193 }
11941194 ty:: AssocKind :: Type => {
@@ -1282,7 +1282,7 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem {
12821282
12831283 if self . defaultness . has_value ( ) {
12841284 AssocTypeItem (
1285- Typedef {
1285+ Box :: new ( Typedef {
12861286 type_ : clean_middle_ty (
12871287 tcx. type_of ( self . def_id ) ,
12881288 cx,
@@ -1291,7 +1291,7 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem {
12911291 generics,
12921292 // FIXME: should we obtain the Type from HIR and pass it on here?
12931293 item_type : None ,
1294- } ,
1294+ } ) ,
12951295 bounds,
12961296 )
12971297 } else {
@@ -1300,11 +1300,11 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem {
13001300 } else {
13011301 // FIXME: when could this happen? Associated items in inherent impls?
13021302 AssocTypeItem (
1303- Typedef {
1303+ Box :: new ( Typedef {
13041304 type_ : clean_middle_ty ( tcx. type_of ( self . def_id ) , cx, Some ( self . def_id ) ) ,
13051305 generics : Generics { params : Vec :: new ( ) , where_predicates : Vec :: new ( ) } ,
13061306 item_type : None ,
1307- } ,
1307+ } ) ,
13081308 Vec :: new ( ) ,
13091309 )
13101310 }
@@ -1949,11 +1949,11 @@ fn clean_maybe_renamed_item<'tcx>(
19491949 ItemKind :: TyAlias ( hir_ty, generics) => {
19501950 let rustdoc_ty = clean_ty ( hir_ty, cx) ;
19511951 let ty = clean_middle_ty ( hir_ty_to_ty ( cx. tcx , hir_ty) , cx, None ) ;
1952- TypedefItem ( Typedef {
1952+ TypedefItem ( Box :: new ( Typedef {
19531953 type_ : rustdoc_ty,
19541954 generics : generics. clean ( cx) ,
19551955 item_type : Some ( ty) ,
1956- } )
1956+ } ) )
19571957 }
19581958 ItemKind :: Enum ( ref def, generics) => EnumItem ( Enum {
19591959 variants : def. variants . iter ( ) . map ( |v| v. clean ( cx) ) . collect ( ) ,
@@ -2041,7 +2041,7 @@ fn clean_impl<'tcx>(
20412041 _ => None ,
20422042 } ) ;
20432043 let mut make_item = |trait_ : Option < Path > , for_ : Type , items : Vec < Item > | {
2044- let kind = ImplItem ( Impl {
2044+ let kind = ImplItem ( Box :: new ( Impl {
20452045 unsafety : impl_. unsafety ,
20462046 generics : impl_. generics . clean ( cx) ,
20472047 trait_,
@@ -2053,7 +2053,7 @@ fn clean_impl<'tcx>(
20532053 } else {
20542054 ImplKind :: Normal
20552055 } ,
2056- } ) ;
2056+ } ) ) ;
20572057 Item :: from_hir_id_and_parts ( hir_id, None , kind, cx)
20582058 } ;
20592059 if let Some ( type_alias) = type_alias {
@@ -2108,7 +2108,7 @@ fn clean_extern_crate<'tcx>(
21082108 attrs: Box :: new( attrs. clean( cx) ) ,
21092109 item_id: crate_def_id. into( ) ,
21102110 visibility: clean_visibility( ty_vis) ,
2111- kind: box ExternCrateItem { src: orig_name } ,
2111+ kind: Box :: new ( ExternCrateItem { src: orig_name } ) ,
21122112 cfg: attrs. cfg( cx. tcx, & cx. cache. hidden_cfg) ,
21132113 } ]
21142114}
@@ -2243,7 +2243,7 @@ fn clean_maybe_renamed_foreign_item<'tcx>(
22432243 let decl = clean_fn_decl_with_args ( cx, decl, args) ;
22442244 ( generics, decl)
22452245 } ) ;
2246- ForeignFunctionItem ( Function { decl, generics } )
2246+ ForeignFunctionItem ( Box :: new ( Function { decl, generics } ) )
22472247 }
22482248 hir:: ForeignItemKind :: Static ( ty, mutability) => {
22492249 ForeignStaticItem ( Static { type_ : clean_ty ( ty, cx) , mutability, expr : None } )
0 commit comments