Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit 07c3e42

Browse files
committed
replace a macro by a function
1 parent 820f322 commit 07c3e42

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

tests/pass/weak_memory/weak.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ fn seq_cst() -> bool {
7272

7373
fn initialization_write() -> bool {
7474
let x = static_atomic(11);
75-
assert_eq!(x.load(Relaxed), 11);
75+
assert_eq!(x.load(Relaxed), 11); // work around https://github.com/rust-lang/miri/issues/2164
7676

7777
let wait = static_atomic(0);
7878

@@ -94,15 +94,13 @@ fn initialization_write() -> bool {
9494
r2 == 11
9595
}
9696

97-
// Asserts that the function returns true at least once in 100 runs
98-
macro_rules! assert_once {
99-
($f:ident) => {
100-
assert!(std::iter::repeat_with(|| $f()).take(100).any(|x| x));
101-
};
97+
/// Asserts that the function returns true at least once in 100 runs
98+
fn assert_once(f: fn() -> bool) {
99+
assert!(std::iter::repeat_with(|| f()).take(100).any(|x| x));
102100
}
103101

104102
pub fn main() {
105-
assert_once!(relaxed);
106-
assert_once!(seq_cst);
107-
assert_once!(initialization_write);
103+
assert_once(relaxed);
104+
assert_once(seq_cst);
105+
assert_once(initialization_write);
108106
}

0 commit comments

Comments
 (0)