Skip to content

Commit

Permalink
is_foreign_item
Browse files Browse the repository at this point in the history
  • Loading branch information
hackeryarn committed May 5, 2017
1 parent 5b71d76 commit 5a7946d
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 10 deletions.
2 changes: 0 additions & 2 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ pub trait CrateStore {
// flags
fn is_const_fn(&self, did: DefId) -> bool;
fn is_default_impl(&self, impl_did: DefId) -> bool;
fn is_foreign_item(&self, did: DefId) -> bool;
fn is_dllimport_foreign_item(&self, def: DefId) -> bool;
fn is_statically_included_foreign_item(&self, def_id: DefId) -> bool;
fn is_exported_symbol(&self, def_id: DefId) -> bool;
Expand Down Expand Up @@ -319,7 +318,6 @@ impl CrateStore for DummyCrateStore {
// flags
fn is_const_fn(&self, did: DefId) -> bool { bug!("is_const_fn") }
fn is_default_impl(&self, impl_did: DefId) -> bool { bug!("is_default_impl") }
fn is_foreign_item(&self, did: DefId) -> bool { bug!("is_foreign_item") }
fn is_dllimport_foreign_item(&self, id: DefId) -> bool { false }
fn is_statically_included_foreign_item(&self, def_id: DefId) -> bool { false }
fn is_exported_symbol(&self, def_id: DefId) -> bool { false }
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/middle/effect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EffectCheckVisitor<'a, 'tcx> {
} else if match self.tcx.hir.get_if_local(def_id) {
Some(hir::map::NodeForeignItem(..)) => true,
Some(..) => false,
None => self.tcx.sess.cstore.is_foreign_item(def_id),
None => self.tcx.is_foreign_item(def_id),
} {
self.require_unsafe_ext(expr.id, expr.span, "use of extern static", true);
}
Expand Down
4 changes: 0 additions & 4 deletions src/librustc_metadata/cstore_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,6 @@ impl CrateStore for cstore::CStore {
self.get_crate_data(impl_did.krate).is_default_impl(impl_did.index)
}

fn is_foreign_item(&self, did: DefId) -> bool {
self.get_crate_data(did.krate).is_foreign_item(did.index)
}

fn is_statically_included_foreign_item(&self, def_id: DefId) -> bool
{
self.do_is_statically_included_foreign_item(def_id)
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/back/symbol_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance
_ => false
}
} else {
tcx.sess.cstore.is_foreign_item(def_id)
tcx.is_foreign_item(def_id)
};

if let Some(name) = weak_lang_items::link_name(&attrs) {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/collector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ fn should_trans_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: &Instan
Some(_) => true,
None => {
if tcx.sess.cstore.is_exported_symbol(def_id) ||
tcx.sess.cstore.is_foreign_item(def_id)
tcx.is_foreign_item(def_id)
{
// We can link to the item in question, no instance needed
// in this crate
Expand Down
2 changes: 1 addition & 1 deletion src/librustc_trans/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ pub fn get_static(ccx: &CrateContext, def_id: DefId) -> ValueRef {
llvm::set_thread_local(g, true);
}
}
if ccx.use_dll_storage_attrs() && !ccx.sess().cstore.is_foreign_item(def_id) {
if ccx.use_dll_storage_attrs() && !ccx.tcx().is_foreign_item(def_id) {
// This item is external but not foreign, i.e. it originates from an external Rust
// crate. Since we don't know whether this crate will be linked dynamically or
// statically in the final application, we always mark such symbols as 'dllimport'.
Expand Down

0 comments on commit 5a7946d

Please sign in to comment.