rustc_trait_selection: work around instruction-counting non-determinism.

This commit is contained in:
Eduard-Mihai Burtescu 2020-11-05 19:28:36 +02:00 committed by Eduard-Mihai Burtescu
parent 44783f1db0
commit 85947f0fe2

View file

@ -1525,6 +1525,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
other: &EvaluatedCandidate<'tcx>,
needs_infer: bool,
) -> bool {
// HACK(eddyb) remove instruction-counting noise from `-Z self-profile`.
#[cfg(target_arch = "x86_64")]
unsafe {
std::arch::asm!("mfence", options(nostack));
}
if victim.candidate == other.candidate {
return true;
}