fn report_non_const_call_targets(loader: &Loader, report_path: &Path) {
    let const_calls: HashSet<_> = loader
        .load_terminators_call_const_target()
        .iter()
        .map(|(call, _def_path)| *call)
        .collect();
    let build_resolver = BuildResolver::new(loader);
    let strings = loader.load_strings();
    let abis = loader.load_abis();
    let unsafe_block_calls = loader.load_unsafe_block_calls();
    let non_const_calls = unsafe_block_calls.iter().flat_map(
        |(build, block, unsafe_scope, check_mode, call, unsafety, abi, _return_ty)| {
            if const_calls.contains(call) {
                None
            } else {
                Some((
                    build,
                    build_resolver.resolve(*build),
                    block,
                    unsafe_scope,
                    check_mode.to_string(),
                    call,
                    unsafety.to_string(),
                    strings[abis[*abi]].to_string(),
                ))
            }
        },
    );
    write_csv!(report_path, non_const_calls);
    info!("reported non_const_call_targets");
}
/// Find all calls in unsafe functions that call non-constant targets. In other
/// words, find all calls that call function pointers.
Find all calls in unsafe functions that call non-constant targets. In other
words, find all calls that call function pointers.
Find all calls in unsafe functions that call non - constant targets . In other words find all calls that call function pointers .
fn report_non_const_call_targets(loader: &Loader, report_path: &Path) {
    let const_calls: HashSet<_> = loader
        .load_terminators_call_const_target()
        .iter()
        .map(|(call, _def_path)| *call)
        .collect();
    let build_resolver = BuildResolver::new(loader);
    let strings = loader.load_strings();
    let abis = loader.load_abis();
    let unsafe_block_calls = loader.load_unsafe_block_calls();
    let non_const_calls = unsafe_block_calls.iter().flat_map(
        |(build, block, unsafe_scope, check_mode, call, unsafety, abi, _return_ty)| {
            if const_calls.contains(call) {
                None
            } else {
                Some((
                    build,
                    build_resolver.resolve(*build),
                    block,
                    unsafe_scope,
                    check_mode.to_string(),
                    call,
                    unsafety.to_string(),
                    strings[abis[*abi]].to_string(),
                ))
            }
        },
    );
    write_csv!(report_path, non_const_calls);
    info!("reported non_const_call_targets");
}
fn report_non_const_call_targets ( loader : & Loader , report_path : & Path ) { let const_calls : HashSet < _ > = loader . load_terminators_call_const_target ( ) . iter ( ) . map ( | ( call , _def_path ) | * call ) . collect ( ) ; let build_resolver = BuildResolver :: new ( loader ) ; let strings = loader . load_strings ( ) ; let abis = loader . load_abis ( ) ; let unsafe_block_calls = loader . load_unsafe_block_calls ( ) ; let non_const_calls = unsafe_block_calls . iter ( ) . flat_map ( | ( build , block , unsafe_scope , check_mode , call , unsafety , abi , _return_ty ) | { if const_calls . contains ( call ) { None } else { Some ( ( build , build_resolver . resolve ( * build ) , block , unsafe_scope , check_mode . to_string ( ) , call , unsafety . to_string ( ) , strings [ abis [ * abi ] ] . to_string ( ) , ) ) } } , ) ; write_csv ! ( report_path non_const_calls ) ; info ! ( " " ) ; }
Find all calls in unsafe functions that call non-constant targets.
Find all calls in unsafe functions that call non - constant targets .
loader
&Loader
report_path
&Path