@@ -403,8 +403,8 @@ impl<'tcx> Clean<Type> for ty::ProjectionTy<'tcx> {
403
403
Type :: QPath {
404
404
name : cx. tcx . associated_item ( self . item_def_id ) . ident . name ,
405
405
self_def_id : self_type. def_id ( ) ,
406
- self_type : box self_type,
407
- trait_ : box trait_,
406
+ self_type : Box :: new ( self_type) ,
407
+ trait_ : Box :: new ( trait_) ,
408
408
}
409
409
}
410
410
}
@@ -1305,8 +1305,8 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
1305
1305
Type :: QPath {
1306
1306
name : p. segments . last ( ) . expect ( "segments were empty" ) . ident . name ,
1307
1307
self_def_id : Some ( DefId :: local ( qself. hir_id . owner . local_def_index ) ) ,
1308
- self_type : box qself. clean ( cx) ,
1309
- trait_ : box resolve_type ( cx, trait_path, hir_id) ,
1308
+ self_type : Box :: new ( qself. clean ( cx) ) ,
1309
+ trait_ : Box :: new ( resolve_type ( cx, trait_path, hir_id) ) ,
1310
1310
}
1311
1311
}
1312
1312
hir:: QPath :: TypeRelative ( ref qself, ref segment) => {
@@ -1320,8 +1320,8 @@ fn clean_qpath(hir_ty: &hir::Ty<'_>, cx: &mut DocContext<'_>) -> Type {
1320
1320
Type :: QPath {
1321
1321
name : segment. ident . name ,
1322
1322
self_def_id : res. opt_def_id ( ) ,
1323
- self_type : box qself. clean ( cx) ,
1324
- trait_ : box resolve_type ( cx, trait_path, hir_id) ,
1323
+ self_type : Box :: new ( qself. clean ( cx) ) ,
1324
+ trait_ : Box :: new ( resolve_type ( cx, trait_path, hir_id) ) ,
1325
1325
}
1326
1326
}
1327
1327
hir:: QPath :: LangItem ( ..) => bug ! ( "clean: requiring documentation of lang item" ) ,
@@ -1334,7 +1334,7 @@ impl Clean<Type> for hir::Ty<'_> {
1334
1334
1335
1335
match self . kind {
1336
1336
TyKind :: Never => Never ,
1337
- TyKind :: Ptr ( ref m) => RawPointer ( m. mutbl , box m. ty . clean ( cx) ) ,
1337
+ TyKind :: Ptr ( ref m) => RawPointer ( m. mutbl , Box :: new ( m. ty . clean ( cx) ) ) ,
1338
1338
TyKind :: Rptr ( ref l, ref m) => {
1339
1339
// There are two times a `Fresh` lifetime can be created:
1340
1340
// 1. For `&'_ x`, written by the user. This corresponds to `lower_lifetime` in `rustc_ast_lowering`.
@@ -1346,9 +1346,9 @@ impl Clean<Type> for hir::Ty<'_> {
1346
1346
let elided =
1347
1347
l. is_elided ( ) || matches ! ( l. name, LifetimeName :: Param ( ParamName :: Fresh ( _) ) ) ;
1348
1348
let lifetime = if elided { None } else { Some ( l. clean ( cx) ) } ;
1349
- BorrowedRef { lifetime, mutability : m. mutbl , type_ : box m. ty . clean ( cx) }
1349
+ BorrowedRef { lifetime, mutability : m. mutbl , type_ : Box :: new ( m. ty . clean ( cx) ) }
1350
1350
}
1351
- TyKind :: Slice ( ref ty) => Slice ( box ty. clean ( cx) ) ,
1351
+ TyKind :: Slice ( ref ty) => Slice ( Box :: new ( ty. clean ( cx) ) ) ,
1352
1352
TyKind :: Array ( ref ty, ref length) => {
1353
1353
let def_id = cx. tcx . hir ( ) . local_def_id ( length. hir_id ) ;
1354
1354
// NOTE(min_const_generics): We can't use `const_eval_poly` for constants
@@ -1361,7 +1361,7 @@ impl Clean<Type> for hir::Ty<'_> {
1361
1361
let ct = ty:: Const :: from_anon_const ( cx. tcx , def_id) ;
1362
1362
let param_env = cx. tcx . param_env ( def_id) ;
1363
1363
let length = print_const ( cx, ct. eval ( cx. tcx , param_env) ) ;
1364
- Array ( box ty. clean ( cx) , length)
1364
+ Array ( Box :: new ( ty. clean ( cx) ) , length)
1365
1365
}
1366
1366
TyKind :: Tup ( ref tys) => Tuple ( tys. clean ( cx) ) ,
1367
1367
TyKind :: OpaqueDef ( item_id, _) => {
@@ -1378,7 +1378,7 @@ impl Clean<Type> for hir::Ty<'_> {
1378
1378
let lifetime = if !lifetime. is_elided ( ) { Some ( lifetime. clean ( cx) ) } else { None } ;
1379
1379
DynTrait ( bounds, lifetime)
1380
1380
}
1381
- TyKind :: BareFn ( ref barefn) => BareFunction ( box barefn. clean ( cx) ) ,
1381
+ TyKind :: BareFn ( ref barefn) => BareFunction ( Box :: new ( barefn. clean ( cx) ) ) ,
1382
1382
TyKind :: Infer | TyKind :: Err => Infer ,
1383
1383
TyKind :: Typeof ( ..) => panic ! ( "unimplemented type {:?}" , self . kind) ,
1384
1384
}
@@ -1428,27 +1428,29 @@ impl<'tcx> Clean<Type> for Ty<'tcx> {
1428
1428
ty:: Uint ( uint_ty) => Primitive ( uint_ty. into ( ) ) ,
1429
1429
ty:: Float ( float_ty) => Primitive ( float_ty. into ( ) ) ,
1430
1430
ty:: Str => Primitive ( PrimitiveType :: Str ) ,
1431
- ty:: Slice ( ty) => Slice ( box ty. clean ( cx) ) ,
1431
+ ty:: Slice ( ty) => Slice ( Box :: new ( ty. clean ( cx) ) ) ,
1432
1432
ty:: Array ( ty, n) => {
1433
1433
let mut n = cx. tcx . lift ( n) . expect ( "array lift failed" ) ;
1434
1434
n = n. eval ( cx. tcx , ty:: ParamEnv :: reveal_all ( ) ) ;
1435
1435
let n = print_const ( cx, n) ;
1436
- Array ( box ty. clean ( cx) , n)
1437
- }
1438
- ty:: RawPtr ( mt) => RawPointer ( mt. mutbl , box mt. ty . clean ( cx) ) ,
1439
- ty:: Ref ( r, ty, mutbl) => {
1440
- BorrowedRef { lifetime : r. clean ( cx) , mutability : mutbl, type_ : box ty. clean ( cx) }
1436
+ Array ( Box :: new ( ty. clean ( cx) ) , n)
1441
1437
}
1438
+ ty:: RawPtr ( mt) => RawPointer ( mt. mutbl , Box :: new ( mt. ty . clean ( cx) ) ) ,
1439
+ ty:: Ref ( r, ty, mutbl) => BorrowedRef {
1440
+ lifetime : r. clean ( cx) ,
1441
+ mutability : mutbl,
1442
+ type_ : Box :: new ( ty. clean ( cx) ) ,
1443
+ } ,
1442
1444
ty:: FnDef ( ..) | ty:: FnPtr ( _) => {
1443
1445
let ty = cx. tcx . lift ( * self ) . expect ( "FnPtr lift failed" ) ;
1444
1446
let sig = ty. fn_sig ( cx. tcx ) ;
1445
1447
let def_id = DefId :: local ( CRATE_DEF_INDEX ) ;
1446
- BareFunction ( box BareFunctionDecl {
1448
+ BareFunction ( Box :: new ( BareFunctionDecl {
1447
1449
unsafety : sig. unsafety ( ) ,
1448
1450
generic_params : Vec :: new ( ) ,
1449
1451
decl : ( def_id, sig) . clean ( cx) ,
1450
1452
abi : sig. abi ( ) ,
1451
- } )
1453
+ } ) )
1452
1454
}
1453
1455
ty:: Adt ( def, substs) => {
1454
1456
let did = def. did ;
@@ -1988,10 +1990,10 @@ fn clean_extern_crate(
1988
1990
// FIXME: using `from_def_id_and_kind` breaks `rustdoc/masked` for some reason
1989
1991
vec ! [ Item {
1990
1992
name: Some ( name) ,
1991
- attrs: box attrs. clean( cx) ,
1993
+ attrs: Box :: new ( attrs. clean( cx) ) ,
1992
1994
def_id: crate_def_id. into( ) ,
1993
1995
visibility: krate. vis. clean( cx) ,
1994
- kind: box ExternCrateItem { src: orig_name } ,
1996
+ kind: Box :: new ( ExternCrateItem { src: orig_name } ) ,
1995
1997
cfg: attrs. cfg( cx. sess( ) ) ,
1996
1998
} ]
1997
1999
}
0 commit comments