Skip to content

Commit c044df2

Browse files
committed
Only avoid shims for the local crate
1 parent 98d2669 commit c044df2

File tree

3 files changed

+1
-17
lines changed

3 files changed

+1
-17
lines changed

Diff for: compiler/rustc_codegen_ssa/src/mir/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ impl<'tcx> MutVisitor<'tcx> for ReplaceThreadLocal<'tcx> {
175175

176176
fn visit_rvalue(&mut self, rvalue: &mut mir::Rvalue<'tcx>, location: mir::Location) {
177177
if let mir::Rvalue::ThreadLocalRef(def_id) = *rvalue {
178-
if self.tcx.is_in_upstream_dylib(def_id.krate) {
178+
if !def_id.is_local() {
179179
*rvalue = mir::Rvalue::Use(mir::Operand::Copy(mir::Place {
180180
local: mir::Local::new(self.local_start + self.list.len()),
181181
projection: self.tcx.intern_place_elems(&[]),

Diff for: compiler/rustc_metadata/src/rmeta/decoder/cstore_impl.rs

-12
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use rustc_hir::def_id::{CrateNum, DefId, DefIdMap, LOCAL_CRATE};
1111
use rustc_hir::definitions::{DefKey, DefPath, DefPathHash};
1212
use rustc_middle::arena::ArenaAllocatable;
1313
use rustc_middle::metadata::ModChild;
14-
use rustc_middle::middle::dependency_format::Linkage;
1514
use rustc_middle::middle::exported_symbols::ExportedSymbol;
1615
use rustc_middle::middle::stability::DeprecationEntry;
1716
use rustc_middle::ty::fast_reject::SimplifiedType;
@@ -502,17 +501,6 @@ pub(in crate::rmeta) fn provide(providers: &mut Providers) {
502501
tcx.arena
503502
.alloc_slice(&CStore::from_tcx(tcx).crate_dependencies_in_postorder(LOCAL_CRATE))
504503
},
505-
is_in_upstream_dylib: |tcx, cnum| {
506-
if cnum == LOCAL_CRATE {
507-
return false;
508-
}
509-
tcx.dependency_formats(()).iter().any(|(_, linkage)| {
510-
match linkage[cnum.as_usize() - 1] {
511-
Linkage::NotLinked | Linkage::Static => false,
512-
Linkage::IncludedFromDylib | Linkage::Dynamic => true,
513-
}
514-
})
515-
},
516504
crates: |tcx, ()| tcx.arena.alloc_from_iter(CStore::from_tcx(tcx).crates_untracked()),
517505
..*providers
518506
};

Diff for: compiler/rustc_middle/src/query/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -1808,10 +1808,6 @@ rustc_queries! {
18081808
eval_always
18091809
desc { "generating a postorder list of CrateNums" }
18101810
}
1811-
query is_in_upstream_dylib(_: CrateNum) -> bool {
1812-
eval_always
1813-
desc { "checking if a crate is placed in an upstream dylib" }
1814-
}
18151811
/// Returns whether or not the crate with CrateNum 'cnum'
18161812
/// is marked as a private dependency
18171813
query is_private_dep(c: CrateNum) -> bool {

0 commit comments

Comments
 (0)