pub fn filter_reachable_ids(tcx: TyCtxt, reachable: NodeSet) -> NodeSet {
    reachable.into_iter().filter(|&id| {
        // Next, we want to ignore some FFI functions that are not exposed from
        // this crate. Reachable FFI functions can be lumped into two
        // categories:
        //
        // 1. Those that are included statically via a static library
        // 2. Those included otherwise (e.g. dynamically or via a framework)
        //
        // Although our LLVM module is not literally emitting code for the
        // statically included symbols, it's an export of our library which
        // needs to be passed on to the linker and encoded in the metadata.
        //
        // As a result, if this id is an FFI item (foreign item) then we only
        // let it through if it's included statically.
        match tcx.map.get(id) {
            hir_map::NodeForeignItem(..) => {
                tcx.sess.cstore.is_statically_included_foreign_item(id)
            }

            // Only consider nodes that actually have exported symbols.
            hir_map::NodeItem(&hir::Item {
                node: hir::ItemStatic(..), .. }) |
            hir_map::NodeItem(&hir::Item {
                node: hir::ItemFn(..), .. }) |
            hir_map::NodeImplItem(&hir::ImplItem {
                node: hir::ImplItemKind::Method(..), .. }) => {
                let def_id = tcx.map.local_def_id(id);
                let scheme = tcx.lookup_item_type(def_id);
                scheme.generics.types.is_empty()
            }

            _ => false
        }
    }).collect()
}
/// The context provided lists a set of reachable ids as calculated by
/// middle::reachable, but this contains far more ids and symbols than we're
/// actually exposing from the object file. This function will filter the set in
/// the context to the set of ids which correspond to symbols that are exposed
/// from the object file being generated.
///
/// This list is later used by linkers to determine the set of symbols needed to
/// be exposed from a dynamic library and it's also encoded into the metadata.
The context provided lists a set of reachable ids as calculated by
middle::reachable, but this contains far more ids and symbols than we're
actually exposing from the object file. This function will filter the set in
the context to the set of ids which correspond to symbols that are exposed
from the object file being generated.

This list is later used by linkers to determine the set of symbols needed to
be exposed from a dynamic library and it's also encoded into the metadata.
The context provided lists a set of reachable ids as calculated by middle :: reachable but this contains far more ids and symbols than we ' re actually exposing from the object file . This function will filter the set in the context to the set of ids which correspond to symbols that are exposed from the object file being generated . This list is later used by linkers to determine the set of symbols needed to be exposed from a dynamic library and it ' s also encoded into the metadata .
pub fn filter_reachable_ids(tcx: TyCtxt, reachable: NodeSet) -> NodeSet {
    reachable.into_iter().filter(|&id| {
        // Next, we want to ignore some FFI functions that are not exposed from
        // this crate. Reachable FFI functions can be lumped into two
        // categories:
        //
        // 1. Those that are included statically via a static library
        // 2. Those included otherwise (e.g. dynamically or via a framework)
        //
        // Although our LLVM module is not literally emitting code for the
        // statically included symbols, it's an export of our library which
        // needs to be passed on to the linker and encoded in the metadata.
        //
        // As a result, if this id is an FFI item (foreign item) then we only
        // let it through if it's included statically.
        match tcx.map.get(id) {
            hir_map::NodeForeignItem(..) => {
                tcx.sess.cstore.is_statically_included_foreign_item(id)
            }
            // Only consider nodes that actually have exported symbols.
            hir_map::NodeItem(&hir::Item {
                node: hir::ItemStatic(..), .. }) |
            hir_map::NodeItem(&hir::Item {
                node: hir::ItemFn(..), .. }) |
            hir_map::NodeImplItem(&hir::ImplItem {
                node: hir::ImplItemKind::Method(..), .. }) => {
                let def_id = tcx.map.local_def_id(id);
                let scheme = tcx.lookup_item_type(def_id);
                scheme.generics.types.is_empty()
            }
            _ => false
        }
    }).collect()
}
pub fn filter_reachable_ids ( tcx : TyCtxt , reachable : NodeSet ) -> NodeSet { reachable . into_iter ( ) . filter ( | & id | { // Next, we want to ignore some FFI functions that are not exposed from // this crate. Reachable FFI functions can be lumped into two // categories: // // 1. Those that are included statically via a static library // 2. Those included otherwise (e.g. dynamically or via a framework) // // Although our LLVM module is not literally emitting code for the // statically included symbols, it's an export of our library which // needs to be passed on to the linker and encoded in the metadata. // // As a result, if this id is an FFI item (foreign item) then we only // let it through if it's included statically. match tcx . map . get ( id ) { hir_map :: NodeForeignItem ( .. ) => { tcx . sess . cstore . is_statically_included_foreign_item ( id ) } // Only consider nodes that actually have exported symbols. hir_map :: NodeItem ( & hir :: Item { node : hir :: ItemStatic ( .. ) , .. } ) | hir_map :: NodeItem ( & hir :: Item { node : hir :: ItemFn ( .. ) , .. } ) | hir_map :: NodeImplItem ( & hir :: ImplItem { node : hir :: ImplItemKind :: Method ( .. ) , .. } ) => { let def_id = tcx . map . local_def_id ( id ) ; let scheme = tcx . lookup_item_type ( def_id ) ; scheme . generics . types . is_empty ( ) } _ => false } } ) . collect ( ) }
The context provided lists a set of reachable ids as calculated by
middle::reachable, but this contains far more ids and symbols than we're
actually exposing from the object file.
The context provided lists a set of reachable ids as calculated by middle :: reachable but this contains far more ids and symbols than we ' re actually exposing from the object file .
tcx
TyCtxt
reachable
NodeSet
tcx
TyCtxt
reachable
NodeSet