mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Merge #5357
5357: Use relaxed ordering for marks r=matklad a=matklad
We dont' need this for perf. `Relaxed` ordering is enough here, as we
only have one location. I prefer to use minimal ordering, because that
makes it easier to reason about the code.
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
a34f79b174
1 changed files with 2 additions and 2 deletions
|
@ -62,7 +62,7 @@ pub struct MarkChecker {
|
|||
|
||||
impl MarkChecker {
|
||||
pub fn new(mark: &'static AtomicUsize) -> MarkChecker {
|
||||
let value_on_entry = mark.load(Ordering::SeqCst);
|
||||
let value_on_entry = mark.load(Ordering::Relaxed);
|
||||
MarkChecker { mark, value_on_entry }
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ impl Drop for MarkChecker {
|
|||
if std::thread::panicking() {
|
||||
return;
|
||||
}
|
||||
let value_on_exit = self.mark.load(Ordering::SeqCst);
|
||||
let value_on_exit = self.mark.load(Ordering::Relaxed);
|
||||
assert!(value_on_exit > self.value_on_entry, "mark was not hit")
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue