Skip to content

Commit

Permalink
Auto merge of #45176 - michaelwoerister:fix-region-and-trans-item-ord…
Browse files Browse the repository at this point in the history
…er, r=nikomatsakis

incr.comp.: Fix HashStable for ty::RegionKind and trans item order

Fixes #45161 and the failing rust-icci tests.

r? @nikomatsakis
  • Loading branch information
bors committed Oct 12, 2017
2 parents 39fd958 + 1235836 commit 1807f27
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/librustc/ich/impls_ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ for ty::RegionKind {
def_id.hash_stable(hcx, hasher);
name.hash_stable(hcx, hasher);
}
ty::ReLateBound(db, ty::BrEnv) => {
db.depth.hash_stable(hcx, hasher);
}
ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, index, name }) => {
def_id.hash_stable(hcx, hasher);
index.hash_stable(hcx, hasher);
Expand Down
23 changes: 20 additions & 3 deletions src/librustc_trans/partitioning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,27 @@ pub trait CodegenUnitExt<'tcx> {
fn item_sort_key<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
item: TransItem<'tcx>) -> ItemSortKey {
ItemSortKey(match item {
TransItem::Fn(instance) => {
tcx.hir.as_local_node_id(instance.def_id())
TransItem::Fn(ref instance) => {
match instance.def {
// We only want to take NodeIds of user-defined
// instances into account. The others don't matter for
// the codegen tests and can even make item order
// unstable.
InstanceDef::Item(def_id) => {
tcx.hir.as_local_node_id(def_id)
}
InstanceDef::Intrinsic(..) |
InstanceDef::FnPtrShim(..) |
InstanceDef::Virtual(..) |
InstanceDef::ClosureOnceShim { .. } |
InstanceDef::DropGlue(..) |
InstanceDef::CloneShim(..) => {
None
}
}
}
TransItem::Static(node_id) | TransItem::GlobalAsm(node_id) => {
TransItem::Static(node_id) |
TransItem::GlobalAsm(node_id) => {
Some(node_id)
}
}, item.symbol_name(tcx))
Expand Down

0 comments on commit 1807f27

Please sign in to comment.