Skip to content

Commit

Permalink
incr.comp.: Take names of children into account when computing the IC…
Browse files Browse the repository at this point in the history
…H of a module's HIR.
  • Loading branch information
michaelwoerister committed Jul 2, 2018
1 parent a53bd20 commit 79d8d08
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
29 changes: 22 additions & 7 deletions src/librustc/ich/impls_hir.rs
Expand Up @@ -756,13 +756,28 @@ impl_stable_hash_for!(enum hir::ImplPolarity {
Negative
});

impl_stable_hash_for!(struct hir::Mod {
inner,
// We are not hashing the IDs of the items contained in the module.
// This is harmless and matches the current behavior but it's not
// actually correct. See issue #40876.
item_ids -> _,
});
impl<'a> HashStable<StableHashingContext<'a>> for hir::Mod {
fn hash_stable<W: StableHasherResult>(&self,
hcx: &mut StableHashingContext<'a>,
hasher: &mut StableHasher<W>) {
let hir::Mod {
inner: ref inner_span,
ref item_ids,
} = *self;

inner_span.hash_stable(hcx, hasher);

let mut item_ids: Vec<DefPathHash> = item_ids.iter().map(|id| {
let (def_path_hash, local_id) = id.id.to_stable_hash_key(hcx);
debug_assert_eq!(local_id, hir::ItemLocalId(0));
def_path_hash
}).collect();

item_ids.sort_unstable();

item_ids.hash_stable(hcx, hasher);
}
}

impl_stable_hash_for!(struct hir::ForeignMod {
abi,
Expand Down
5 changes: 2 additions & 3 deletions src/librustc_codegen_llvm/mono_item.rs
Expand Up @@ -25,11 +25,10 @@ use monomorphize::Instance;
use type_of::LayoutLlvmExt;
use rustc::hir;
use rustc::hir::def::Def;
use rustc::hir::def_id::DefId;
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
use rustc::mir::mono::{Linkage, Visibility};
use rustc::ty::TypeFoldable;
use rustc::ty::layout::LayoutOf;
use syntax::attr;
use std::fmt;

pub use rustc::mir::mono::MonoItem;
Expand Down Expand Up @@ -173,7 +172,7 @@ fn predefine_fn<'a, 'tcx>(cx: &CodegenCx<'a, 'tcx>,
// visibility as we're going to link this object all over the place but
// don't want the symbols to get exported.
if linkage != Linkage::Internal && linkage != Linkage::Private &&
attr::contains_name(cx.tcx.hir.krate_attrs(), "compiler_builtins") {
cx.tcx.is_compiler_builtins(LOCAL_CRATE) {
unsafe {
llvm::LLVMRustSetVisibility(lldecl, llvm::Visibility::Hidden);
}
Expand Down

0 comments on commit 79d8d08

Please sign in to comment.