We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 4b51df3 + b5786dc commit ea42f3cCopy full SHA for ea42f3c
library/std/src/sys_common/thread_local_key/tests.rs
@@ -1,4 +1,5 @@
1
use super::{Key, StaticKey};
2
+use core::ptr;
3
4
fn assert_sync<T: Sync>() {}
5
fn assert_send<T: Send>() {}
@@ -12,8 +13,8 @@ fn smoke() {
12
13
let k2 = Key::new(None);
14
assert!(k1.get().is_null());
15
assert!(k2.get().is_null());
- k1.set(1 as *mut _);
16
- k2.set(2 as *mut _);
+ k1.set(ptr::invalid_mut(1));
17
+ k2.set(ptr::invalid_mut(2));
18
assert_eq!(k1.get() as usize, 1);
19
assert_eq!(k2.get() as usize, 2);
20
}
@@ -26,8 +27,8 @@ fn statik() {
26
27
unsafe {
28
assert!(K1.get().is_null());
29
assert!(K2.get().is_null());
- K1.set(1 as *mut _);
30
- K2.set(2 as *mut _);
+ K1.set(ptr::invalid_mut(1));
31
+ K2.set(ptr::invalid_mut(2));
32
assert_eq!(K1.get() as usize, 1);
33
assert_eq!(K2.get() as usize, 2);
34
0 commit comments