From 7a016c1ca6a6f27876fd07b1aa67e55ca6cba231 Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Tue, 10 Oct 2017 17:08:29 +0200 Subject: [PATCH 1/2] incr.comp.: Add missing match branch in HashStable impl for ty::RegionKind. --- src/librustc/ich/impls_ty.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index fe060aaf4269e..582c4e13a82ca 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -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); From 1235836f678eeae33c841ae5b8975b3967be886f Mon Sep 17 00:00:00 2001 From: Michael Woerister Date: Tue, 10 Oct 2017 17:11:08 +0200 Subject: [PATCH 2/2] incr.comp.: Fix instability in CodegenUnitExt::items_in_deterministic_order(). --- src/librustc_trans/partitioning.rs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/librustc_trans/partitioning.rs b/src/librustc_trans/partitioning.rs index 0d46ea64f9f7f..386806e4c9c9f 100644 --- a/src/librustc_trans/partitioning.rs +++ b/src/librustc_trans/partitioning.rs @@ -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))