@@ -908,15 +908,15 @@ fn clean_function<'tcx>(
908
908
sig : & hir:: FnSig < ' tcx > ,
909
909
generics : & hir:: Generics < ' tcx > ,
910
910
body_id : hir:: BodyId ,
911
- ) -> Function {
911
+ ) -> Box < Function > {
912
912
let ( generics, decl) = enter_impl_trait ( cx, |cx| {
913
913
// NOTE: generics must be cleaned before args
914
914
let generics = generics. clean ( cx) ;
915
915
let args = clean_args_from_types_and_body_id ( cx, sig. decl . inputs , body_id) ;
916
916
let decl = clean_fn_decl_with_args ( cx, sig. decl , args) ;
917
917
( generics, decl)
918
918
} ) ;
919
- Function { decl, generics }
919
+ Box :: new ( Function { decl, generics } )
920
920
}
921
921
922
922
fn clean_args_from_types_and_names < ' tcx > (
@@ -1061,18 +1061,18 @@ impl<'tcx> Clean<'tcx, Item> for hir::TraitItem<'tcx> {
1061
1061
let decl = clean_fn_decl_with_args ( cx, sig. decl , args) ;
1062
1062
( generics, decl)
1063
1063
} ) ;
1064
- TyMethodItem ( Function { decl, generics } )
1064
+ TyMethodItem ( Box :: new ( Function { decl, generics } ) )
1065
1065
}
1066
1066
hir:: TraitItemKind :: Type ( bounds, Some ( default) ) => {
1067
1067
let generics = enter_impl_trait ( cx, |cx| self . generics . clean ( cx) ) ;
1068
1068
let bounds = bounds. iter ( ) . filter_map ( |x| x. clean ( cx) ) . collect ( ) ;
1069
1069
let item_type = clean_middle_ty ( hir_ty_to_ty ( cx. tcx , default) , cx, None ) ;
1070
1070
AssocTypeItem (
1071
- Typedef {
1071
+ Box :: new ( Typedef {
1072
1072
type_ : clean_ty ( default, cx) ,
1073
1073
generics,
1074
1074
item_type : Some ( item_type) ,
1075
- } ,
1075
+ } ) ,
1076
1076
bounds,
1077
1077
)
1078
1078
}
@@ -1109,7 +1109,7 @@ impl<'tcx> Clean<'tcx, Item> for hir::ImplItem<'tcx> {
1109
1109
let generics = self . generics . clean ( cx) ;
1110
1110
let item_type = clean_middle_ty ( hir_ty_to_ty ( cx. tcx , hir_ty) , cx, None ) ;
1111
1111
AssocTypeItem (
1112
- Typedef { type_, generics, item_type : Some ( item_type) } ,
1112
+ Box :: new ( Typedef { type_, generics, item_type : Some ( item_type) } ) ,
1113
1113
Vec :: new ( ) ,
1114
1114
)
1115
1115
}
@@ -1186,9 +1186,9 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem {
1186
1186
ty:: ImplContainer ( _) => Some ( self . defaultness ) ,
1187
1187
ty:: TraitContainer ( _) => None ,
1188
1188
} ;
1189
- MethodItem ( Function { generics, decl } , defaultness)
1189
+ MethodItem ( Box :: new ( Function { generics, decl } ) , defaultness)
1190
1190
} else {
1191
- TyMethodItem ( Function { generics, decl } )
1191
+ TyMethodItem ( Box :: new ( Function { generics, decl } ) )
1192
1192
}
1193
1193
}
1194
1194
ty:: AssocKind :: Type => {
@@ -1282,7 +1282,7 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem {
1282
1282
1283
1283
if self . defaultness . has_value ( ) {
1284
1284
AssocTypeItem (
1285
- Typedef {
1285
+ Box :: new ( Typedef {
1286
1286
type_ : clean_middle_ty (
1287
1287
tcx. type_of ( self . def_id ) ,
1288
1288
cx,
@@ -1291,7 +1291,7 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem {
1291
1291
generics,
1292
1292
// FIXME: should we obtain the Type from HIR and pass it on here?
1293
1293
item_type : None ,
1294
- } ,
1294
+ } ) ,
1295
1295
bounds,
1296
1296
)
1297
1297
} else {
@@ -1300,11 +1300,11 @@ impl<'tcx> Clean<'tcx, Item> for ty::AssocItem {
1300
1300
} else {
1301
1301
// FIXME: when could this happen? Associated items in inherent impls?
1302
1302
AssocTypeItem (
1303
- Typedef {
1303
+ Box :: new ( Typedef {
1304
1304
type_ : clean_middle_ty ( tcx. type_of ( self . def_id ) , cx, Some ( self . def_id ) ) ,
1305
1305
generics : Generics { params : Vec :: new ( ) , where_predicates : Vec :: new ( ) } ,
1306
1306
item_type : None ,
1307
- } ,
1307
+ } ) ,
1308
1308
Vec :: new ( ) ,
1309
1309
)
1310
1310
}
@@ -1949,11 +1949,11 @@ fn clean_maybe_renamed_item<'tcx>(
1949
1949
ItemKind :: TyAlias ( hir_ty, generics) => {
1950
1950
let rustdoc_ty = clean_ty ( hir_ty, cx) ;
1951
1951
let ty = clean_middle_ty ( hir_ty_to_ty ( cx. tcx , hir_ty) , cx, None ) ;
1952
- TypedefItem ( Typedef {
1952
+ TypedefItem ( Box :: new ( Typedef {
1953
1953
type_ : rustdoc_ty,
1954
1954
generics : generics. clean ( cx) ,
1955
1955
item_type : Some ( ty) ,
1956
- } )
1956
+ } ) )
1957
1957
}
1958
1958
ItemKind :: Enum ( ref def, generics) => EnumItem ( Enum {
1959
1959
variants : def. variants . iter ( ) . map ( |v| v. clean ( cx) ) . collect ( ) ,
@@ -2041,7 +2041,7 @@ fn clean_impl<'tcx>(
2041
2041
_ => None ,
2042
2042
} ) ;
2043
2043
let mut make_item = |trait_ : Option < Path > , for_ : Type , items : Vec < Item > | {
2044
- let kind = ImplItem ( Impl {
2044
+ let kind = ImplItem ( Box :: new ( Impl {
2045
2045
unsafety : impl_. unsafety ,
2046
2046
generics : impl_. generics . clean ( cx) ,
2047
2047
trait_,
@@ -2053,7 +2053,7 @@ fn clean_impl<'tcx>(
2053
2053
} else {
2054
2054
ImplKind :: Normal
2055
2055
} ,
2056
- } ) ;
2056
+ } ) ) ;
2057
2057
Item :: from_hir_id_and_parts ( hir_id, None , kind, cx)
2058
2058
} ;
2059
2059
if let Some ( type_alias) = type_alias {
@@ -2108,7 +2108,7 @@ fn clean_extern_crate<'tcx>(
2108
2108
attrs: Box :: new( attrs. clean( cx) ) ,
2109
2109
item_id: crate_def_id. into( ) ,
2110
2110
visibility: clean_visibility( ty_vis) ,
2111
- kind: box ExternCrateItem { src: orig_name } ,
2111
+ kind: Box :: new ( ExternCrateItem { src: orig_name } ) ,
2112
2112
cfg: attrs. cfg( cx. tcx, & cx. cache. hidden_cfg) ,
2113
2113
} ]
2114
2114
}
@@ -2243,7 +2243,7 @@ fn clean_maybe_renamed_foreign_item<'tcx>(
2243
2243
let decl = clean_fn_decl_with_args ( cx, decl, args) ;
2244
2244
( generics, decl)
2245
2245
} ) ;
2246
- ForeignFunctionItem ( Function { decl, generics } )
2246
+ ForeignFunctionItem ( Box :: new ( Function { decl, generics } ) )
2247
2247
}
2248
2248
hir:: ForeignItemKind :: Static ( ty, mutability) => {
2249
2249
ForeignStaticItem ( Static { type_ : clean_ty ( ty, cx) , mutability, expr : None } )
0 commit comments