Skip to content

Commit bc57350

Browse files
committed
fix config for poison macro test
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
1 parent 5e33838 commit bc57350

File tree

4 files changed

+18
-15
lines changed

4 files changed

+18
-15
lines changed

library/std/tests/sync/condvar.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ nonpoison_and_poison_unwrap_test!(
1717
}
1818
);
1919

20-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
20+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
2121
nonpoison_and_poison_unwrap_test!(
2222
name: notify_one,
2323
test_body: {
@@ -38,7 +38,7 @@ nonpoison_and_poison_unwrap_test!(
3838
}
3939
);
4040

41-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
41+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
4242
nonpoison_and_poison_unwrap_test!(
4343
name: notify_all,
4444
test_body: {
@@ -79,7 +79,7 @@ nonpoison_and_poison_unwrap_test!(
7979
}
8080
);
8181

82-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
82+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
8383
nonpoison_and_poison_unwrap_test!(
8484
name: test_mutex_arc_condvar,
8585
test_body: {
@@ -116,7 +116,7 @@ nonpoison_and_poison_unwrap_test!(
116116
}
117117
);
118118

119-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
119+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
120120
nonpoison_and_poison_unwrap_test!(
121121
name: wait_while,
122122
test_body: {
@@ -141,7 +141,7 @@ nonpoison_and_poison_unwrap_test!(
141141
}
142142
);
143143

144-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
144+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
145145
nonpoison_and_poison_unwrap_test!(
146146
name: wait_timeout_wait,
147147
test_body: {
@@ -164,7 +164,7 @@ nonpoison_and_poison_unwrap_test!(
164164
}
165165
);
166166

167-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
167+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
168168
nonpoison_and_poison_unwrap_test!(
169169
name: wait_timeout_while_wait,
170170
test_body: {
@@ -180,7 +180,7 @@ nonpoison_and_poison_unwrap_test!(
180180
}
181181
);
182182

183-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
183+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
184184
nonpoison_and_poison_unwrap_test!(
185185
name: wait_timeout_while_instant_satisfy,
186186
test_body: {
@@ -197,7 +197,7 @@ nonpoison_and_poison_unwrap_test!(
197197
}
198198
);
199199

200-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
200+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
201201
nonpoison_and_poison_unwrap_test!(
202202
name: wait_timeout_while_wake,
203203
test_body: {
@@ -226,7 +226,7 @@ nonpoison_and_poison_unwrap_test!(
226226
}
227227
);
228228

229-
#[cfg_attr(any(target_os = "emscripten", target_os = "wasi"), ignore)] // no threads
229+
#[cfg(not(any(target_os = "emscripten", target_os = "wasi")))] // No threads.
230230
nonpoison_and_poison_unwrap_test!(
231231
name: wait_timeout_wake,
232232
test_body: {

library/std/tests/sync/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ fn result_unwrap<T, E: std::fmt::Debug>(x: Result<T, E>) -> T {
5858
/// a no-op (the identity function).
5959
///
6060
/// The test names will be prefiex with `poison_` or `nonpoison_`.
61+
///
62+
/// Important: If you want to add attributes to both tests, use `cfg()` instead of `cfg_attr()`.
63+
/// See <https://github.com/rust-lang/rust/pull/146433> for more information.
6164
macro_rules! nonpoison_and_poison_unwrap_test {
6265
(
6366
name: $name:ident,

library/std/tests/sync/mutex.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ nonpoison_and_poison_unwrap_test!(
266266
}
267267
);
268268

269-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
269+
#[cfg(panic = "unwind")] // Requires unwinding support.
270270
nonpoison_and_poison_unwrap_test!(
271271
name: test_panics,
272272
test_body: {
@@ -297,7 +297,7 @@ nonpoison_and_poison_unwrap_test!(
297297
}
298298
);
299299

300-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
300+
#[cfg(panic = "unwind")] // Requires unwinding support.
301301
nonpoison_and_poison_unwrap_test!(
302302
name: test_mutex_arc_access_in_unwind,
303303
test_body: {

library/std/tests/sync/rwlock.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ nonpoison_and_poison_unwrap_test!(
5050
// FIXME: On macOS we use a provenance-incorrect implementation and Miri
5151
// catches that issue with a chance of around 1/1000.
5252
// See <https://github.com/rust-lang/rust/issues/121950> for details.
53-
#[cfg_attr(all(miri, target_os = "macos"), ignore)]
53+
#[cfg(not(all(miri, target_os = "macos")))]
5454
nonpoison_and_poison_unwrap_test!(
5555
name: frob,
5656
test_body: {
@@ -124,7 +124,7 @@ nonpoison_and_poison_unwrap_test!(
124124
}
125125
);
126126

127-
#[cfg_attr(not(panic = "unwind"), ignore = "test requires unwinding support")]
127+
#[cfg(panic = "unwind")] // Requires unwinding support.
128128
nonpoison_and_poison_unwrap_test!(
129129
name: test_rw_arc_access_in_unwind,
130130
test_body: {
@@ -315,7 +315,7 @@ nonpoison_and_poison_unwrap_test!(
315315

316316
// FIXME: On macOS we use a provenance-incorrect implementation and Miri catches that issue.
317317
// See <https://github.com/rust-lang/rust/issues/121950> for details.
318-
#[cfg_attr(all(miri, target_os = "macos"), ignore)]
318+
#[cfg(not(all(miri, target_os = "macos")))]
319319
nonpoison_and_poison_unwrap_test!(
320320
name: test_downgrade_observe,
321321
test_body: {
@@ -362,7 +362,7 @@ nonpoison_and_poison_unwrap_test!(
362362

363363
// FIXME: On macOS we use a provenance-incorrect implementation and Miri catches that issue.
364364
// See <https://github.com/rust-lang/rust/issues/121950> for details.
365-
#[cfg_attr(all(miri, target_os = "macos"), ignore)]
365+
#[cfg(not(all(miri, target_os = "macos")))]
366366
nonpoison_and_poison_unwrap_test!(
367367
name: test_downgrade_atomic,
368368
test_body: {

0 commit comments

Comments
 (0)