Skip to content

Commit 1807f27

Browse files
committed
Auto merge of #45176 - michaelwoerister:fix-region-and-trans-item-order, r=nikomatsakis
incr.comp.: Fix HashStable for ty::RegionKind and trans item order Fixes #45161 and the failing rust-icci tests. r? @nikomatsakis
2 parents 39fd958 + 1235836 commit 1807f27

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

src/librustc/ich/impls_ty.rs

+3
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ for ty::RegionKind {
6161
def_id.hash_stable(hcx, hasher);
6262
name.hash_stable(hcx, hasher);
6363
}
64+
ty::ReLateBound(db, ty::BrEnv) => {
65+
db.depth.hash_stable(hcx, hasher);
66+
}
6467
ty::ReEarlyBound(ty::EarlyBoundRegion { def_id, index, name }) => {
6568
def_id.hash_stable(hcx, hasher);
6669
index.hash_stable(hcx, hasher);

src/librustc_trans/partitioning.rs

+20-3
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,27 @@ pub trait CodegenUnitExt<'tcx> {
163163
fn item_sort_key<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
164164
item: TransItem<'tcx>) -> ItemSortKey {
165165
ItemSortKey(match item {
166-
TransItem::Fn(instance) => {
167-
tcx.hir.as_local_node_id(instance.def_id())
166+
TransItem::Fn(ref instance) => {
167+
match instance.def {
168+
// We only want to take NodeIds of user-defined
169+
// instances into account. The others don't matter for
170+
// the codegen tests and can even make item order
171+
// unstable.
172+
InstanceDef::Item(def_id) => {
173+
tcx.hir.as_local_node_id(def_id)
174+
}
175+
InstanceDef::Intrinsic(..) |
176+
InstanceDef::FnPtrShim(..) |
177+
InstanceDef::Virtual(..) |
178+
InstanceDef::ClosureOnceShim { .. } |
179+
InstanceDef::DropGlue(..) |
180+
InstanceDef::CloneShim(..) => {
181+
None
182+
}
183+
}
168184
}
169-
TransItem::Static(node_id) | TransItem::GlobalAsm(node_id) => {
185+
TransItem::Static(node_id) |
186+
TransItem::GlobalAsm(node_id) => {
170187
Some(node_id)
171188
}
172189
}, item.symbol_name(tcx))

0 commit comments

Comments
 (0)