Skip to content

Commit 85947f0

Browse files
committed
rustc_trait_selection: work around instruction-counting non-determinism.
1 parent 44783f1 commit 85947f0

File tree

1 file changed

+6
-0
lines changed
  • compiler/rustc_trait_selection/src/traits/select

1 file changed

+6
-0
lines changed

compiler/rustc_trait_selection/src/traits/select/mod.rs

+6
Original file line numberDiff line numberDiff line change
@@ -1525,6 +1525,12 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
15251525
other: &EvaluatedCandidate<'tcx>,
15261526
needs_infer: bool,
15271527
) -> bool {
1528+
// HACK(eddyb) remove instruction-counting noise from `-Z self-profile`.
1529+
#[cfg(target_arch = "x86_64")]
1530+
unsafe {
1531+
std::arch::asm!("mfence", options(nostack));
1532+
}
1533+
15281534
if victim.candidate == other.candidate {
15291535
return true;
15301536
}

0 commit comments

Comments
 (0)