Skip to content

Commit 5a7946d

Browse files
committed
is_foreign_item
1 parent 5b71d76 commit 5a7946d

File tree

6 files changed

+4
-10
lines changed

6 files changed

+4
-10
lines changed

src/librustc/middle/cstore.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ pub trait CrateStore {
195195
// flags
196196
fn is_const_fn(&self, did: DefId) -> bool;
197197
fn is_default_impl(&self, impl_did: DefId) -> bool;
198-
fn is_foreign_item(&self, did: DefId) -> bool;
199198
fn is_dllimport_foreign_item(&self, def: DefId) -> bool;
200199
fn is_statically_included_foreign_item(&self, def_id: DefId) -> bool;
201200
fn is_exported_symbol(&self, def_id: DefId) -> bool;
@@ -319,7 +318,6 @@ impl CrateStore for DummyCrateStore {
319318
// flags
320319
fn is_const_fn(&self, did: DefId) -> bool { bug!("is_const_fn") }
321320
fn is_default_impl(&self, impl_did: DefId) -> bool { bug!("is_default_impl") }
322-
fn is_foreign_item(&self, did: DefId) -> bool { bug!("is_foreign_item") }
323321
fn is_dllimport_foreign_item(&self, id: DefId) -> bool { false }
324322
fn is_statically_included_foreign_item(&self, def_id: DefId) -> bool { false }
325323
fn is_exported_symbol(&self, def_id: DefId) -> bool { false }

src/librustc/middle/effect.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ impl<'a, 'tcx> Visitor<'tcx> for EffectCheckVisitor<'a, 'tcx> {
205205
} else if match self.tcx.hir.get_if_local(def_id) {
206206
Some(hir::map::NodeForeignItem(..)) => true,
207207
Some(..) => false,
208-
None => self.tcx.sess.cstore.is_foreign_item(def_id),
208+
None => self.tcx.is_foreign_item(def_id),
209209
} {
210210
self.require_unsafe_ext(expr.id, expr.span, "use of extern static", true);
211211
}

src/librustc_metadata/cstore_impl.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,10 +176,6 @@ impl CrateStore for cstore::CStore {
176176
self.get_crate_data(impl_did.krate).is_default_impl(impl_did.index)
177177
}
178178

179-
fn is_foreign_item(&self, did: DefId) -> bool {
180-
self.get_crate_data(did.krate).is_foreign_item(did.index)
181-
}
182-
183179
fn is_statically_included_foreign_item(&self, def_id: DefId) -> bool
184180
{
185181
self.do_is_statically_included_foreign_item(def_id)

src/librustc_trans/back/symbol_names.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ fn compute_symbol_name<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: Instance
223223
_ => false
224224
}
225225
} else {
226-
tcx.sess.cstore.is_foreign_item(def_id)
226+
tcx.is_foreign_item(def_id)
227227
};
228228

229229
if let Some(name) = weak_lang_items::link_name(&attrs) {

src/librustc_trans/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ fn should_trans_locally<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, instance: &Instan
653653
Some(_) => true,
654654
None => {
655655
if tcx.sess.cstore.is_exported_symbol(def_id) ||
656-
tcx.sess.cstore.is_foreign_item(def_id)
656+
tcx.is_foreign_item(def_id)
657657
{
658658
// We can link to the item in question, no instance needed
659659
// in this crate

src/librustc_trans/consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ pub fn get_static(ccx: &CrateContext, def_id: DefId) -> ValueRef {
186186
llvm::set_thread_local(g, true);
187187
}
188188
}
189-
if ccx.use_dll_storage_attrs() && !ccx.sess().cstore.is_foreign_item(def_id) {
189+
if ccx.use_dll_storage_attrs() && !ccx.tcx().is_foreign_item(def_id) {
190190
// This item is external but not foreign, i.e. it originates from an external Rust
191191
// crate. Since we don't know whether this crate will be linked dynamically or
192192
// statically in the final application, we always mark such symbols as 'dllimport'.

0 commit comments

Comments
 (0)