@@ -1381,17 +1381,6 @@ fn collect_alloc<'tcx>(tcx: TyCtxt<'tcx>, alloc_id: AllocId, output: &mut MonoIt
1381
1381
}
1382
1382
}
1383
1383
1384
- fn add_assoc_fn < ' tcx > (
1385
- tcx : TyCtxt < ' tcx > ,
1386
- def_id : Option < DefId > ,
1387
- fn_ident : Ident ,
1388
- skip_move_check_fns : & mut Vec < DefId > ,
1389
- ) {
1390
- if let Some ( def_id) = def_id. and_then ( |def_id| assoc_fn_of_type ( tcx, def_id, fn_ident) ) {
1391
- skip_move_check_fns. push ( def_id) ;
1392
- }
1393
- }
1394
-
1395
1384
fn assoc_fn_of_type < ' tcx > ( tcx : TyCtxt < ' tcx > , def_id : DefId , fn_ident : Ident ) -> Option < DefId > {
1396
1385
for impl_def_id in tcx. inherent_impls ( def_id) {
1397
1386
if let Some ( new) = tcx. associated_items ( impl_def_id) . find_by_name_and_kind (
@@ -1407,26 +1396,16 @@ fn assoc_fn_of_type<'tcx>(tcx: TyCtxt<'tcx>, def_id: DefId, fn_ident: Ident) ->
1407
1396
}
1408
1397
1409
1398
fn build_skip_move_check_fns ( tcx : TyCtxt < ' _ > ) -> Vec < DefId > {
1410
- let mut skip_move_check_fns = vec ! [ ] ;
1411
- add_assoc_fn (
1412
- tcx,
1413
- tcx. lang_items ( ) . owned_box ( ) ,
1414
- Ident :: from_str ( "new" ) ,
1415
- & mut skip_move_check_fns,
1416
- ) ;
1417
- add_assoc_fn (
1418
- tcx,
1419
- tcx. get_diagnostic_item ( sym:: Arc ) ,
1420
- Ident :: from_str ( "new" ) ,
1421
- & mut skip_move_check_fns,
1422
- ) ;
1423
- add_assoc_fn (
1424
- tcx,
1425
- tcx. get_diagnostic_item ( sym:: Rc ) ,
1426
- Ident :: from_str ( "new" ) ,
1427
- & mut skip_move_check_fns,
1428
- ) ;
1429
- skip_move_check_fns
1399
+ let fns = [
1400
+ ( tcx. lang_items ( ) . owned_box ( ) , "new" ) ,
1401
+ ( tcx. get_diagnostic_item ( sym:: Rc ) , "new" ) ,
1402
+ ( tcx. get_diagnostic_item ( sym:: Arc ) , "new" ) ,
1403
+ ] ;
1404
+ fns. into_iter ( )
1405
+ . filter_map ( |( def_id, fn_name) | {
1406
+ def_id. and_then ( |def_id| assoc_fn_of_type ( tcx, def_id, Ident :: from_str ( fn_name) ) )
1407
+ } )
1408
+ . collect :: < Vec < _ > > ( )
1430
1409
}
1431
1410
1432
1411
/// Scans the MIR in order to find function calls, closures, and drop-glue.
0 commit comments