Skip to content

Commit d935a8d

Browse files
committed
Fix rustc_trans_utils::find_exported_symbols
Fix denied warnings
1 parent 2c03c57 commit d935a8d

File tree

3 files changed

+2
-54
lines changed

3 files changed

+2
-54
lines changed

src/librustc_trans/back/link.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ use rustc::session::config::{self, NoDebugInfo, OutputFilenames, OutputType, Pri
1818
use rustc::session::filesearch;
1919
use rustc::session::search_paths::PathKind;
2020
use rustc::session::Session;
21-
use rustc::ich::Fingerprint;
22-
use rustc::middle::cstore::{LinkMeta, NativeLibrary, LibSource, NativeLibraryKind};
21+
use rustc::middle::cstore::{NativeLibrary, LibSource, NativeLibraryKind};
2322
use rustc::middle::dependency_format::Linkage;
2423
use {CrateTranslation, CrateInfo};
2524
use rustc::util::common::time;

src/librustc_trans/base.rs

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ use rustc::ty::{self, Ty, TyCtxt};
4343
use rustc::ty::maps::Providers;
4444
use rustc::dep_graph::{DepNode, DepKind};
4545
use rustc::middle::cstore::{self, LinkMeta, LinkagePreference};
46-
use rustc::hir::map as hir_map;
4746
use rustc::util::common::{time, print_time_passes_entry};
4847
use rustc::session::config::{self, NoDebugInfo};
4948
use rustc::session::Session;
@@ -885,56 +884,6 @@ fn iter_globals(llmod: llvm::ModuleRef) -> ValueIter {
885884
}
886885
}
887886

888-
/// The context provided lists a set of reachable ids as calculated by
889-
/// middle::reachable, but this contains far more ids and symbols than we're
890-
/// actually exposing from the object file. This function will filter the set in
891-
/// the context to the set of ids which correspond to symbols that are exposed
892-
/// from the object file being generated.
893-
///
894-
/// This list is later used by linkers to determine the set of symbols needed to
895-
/// be exposed from a dynamic library and it's also encoded into the metadata.
896-
pub fn find_exported_symbols(tcx: TyCtxt) -> NodeSet {
897-
tcx.reachable_set(LOCAL_CRATE).0.iter().cloned().filter(|&id| {
898-
// Next, we want to ignore some FFI functions that are not exposed from
899-
// this crate. Reachable FFI functions can be lumped into two
900-
// categories:
901-
//
902-
// 1. Those that are included statically via a static library
903-
// 2. Those included otherwise (e.g. dynamically or via a framework)
904-
//
905-
// Although our LLVM module is not literally emitting code for the
906-
// statically included symbols, it's an export of our library which
907-
// needs to be passed on to the linker and encoded in the metadata.
908-
//
909-
// As a result, if this id is an FFI item (foreign item) then we only
910-
// let it through if it's included statically.
911-
match tcx.hir.get(id) {
912-
hir_map::NodeForeignItem(..) => {
913-
let def_id = tcx.hir.local_def_id(id);
914-
tcx.is_statically_included_foreign_item(def_id)
915-
}
916-
917-
// Only consider nodes that actually have exported symbols.
918-
hir_map::NodeItem(&hir::Item {
919-
node: hir::ItemStatic(..), .. }) |
920-
hir_map::NodeItem(&hir::Item {
921-
node: hir::ItemFn(..), .. }) |
922-
hir_map::NodeImplItem(&hir::ImplItem {
923-
node: hir::ImplItemKind::Method(..), .. }) => {
924-
let def_id = tcx.hir.local_def_id(id);
925-
let generics = tcx.generics_of(def_id);
926-
let attributes = tcx.get_attrs(def_id);
927-
(generics.parent_types == 0 && generics.types.is_empty()) &&
928-
// Functions marked with #[inline] are only ever translated
929-
// with "internal" linkage and are never exported.
930-
!attr::requests_inline(&attributes)
931-
}
932-
933-
_ => false
934-
}
935-
}).collect()
936-
}
937-
938887
pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
939888
rx: mpsc::Receiver<Box<Any + Send>>)
940889
-> OngoingCrateTranslation {

src/librustc_trans_utils/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ pub fn find_exported_symbols(tcx: TyCtxt, reachable: &NodeSet) -> NodeSet {
7171
match tcx.hir.get(id) {
7272
hir_map::NodeForeignItem(..) => {
7373
let def_id = tcx.hir.local_def_id(id);
74-
tcx.sess.cstore.is_statically_included_foreign_item(def_id)
74+
tcx.is_statically_included_foreign_item(def_id)
7575
}
7676

7777
// Only consider nodes that actually have exported symbols.

0 commit comments

Comments
 (0)