Skip to content

Commit

Permalink
Rollup merge of #100407 - RalfJung:no-int2ptr, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
avoid some int2ptr casts in thread_local_key tests
  • Loading branch information
compiler-errors authored Aug 13, 2022
2 parents 4b51df3 + b5786dc commit ea42f3c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions library/std/src/sys_common/thread_local_key/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use super::{Key, StaticKey};
use core::ptr;

fn assert_sync<T: Sync>() {}
fn assert_send<T: Send>() {}
Expand All @@ -12,8 +13,8 @@ fn smoke() {
let k2 = Key::new(None);
assert!(k1.get().is_null());
assert!(k2.get().is_null());
k1.set(1 as *mut _);
k2.set(2 as *mut _);
k1.set(ptr::invalid_mut(1));
k2.set(ptr::invalid_mut(2));
assert_eq!(k1.get() as usize, 1);
assert_eq!(k2.get() as usize, 2);
}
Expand All @@ -26,8 +27,8 @@ fn statik() {
unsafe {
assert!(K1.get().is_null());
assert!(K2.get().is_null());
K1.set(1 as *mut _);
K2.set(2 as *mut _);
K1.set(ptr::invalid_mut(1));
K2.set(ptr::invalid_mut(2));
assert_eq!(K1.get() as usize, 1);
assert_eq!(K2.get() as usize, 2);
}
Expand Down

0 comments on commit ea42f3c

Please sign in to comment.