Skip to content

Commit 79c50cf

Browse files
YuhanLiinnewAM
authored andcommitted
Fix tsan CI errors
1 parent cbd406e commit 79c50cf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tests/tsan.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
#![deny(rust_2018_idioms)]
33
#![deny(warnings)]
44

5-
use std::thread;
5+
use std::{ptr::addr_of_mut, thread};
66

77
use heapless::spsc;
88

99
#[test]
1010
fn once() {
1111
static mut RB: spsc::Queue<i32, 4> = spsc::Queue::new();
1212

13-
let rb = unsafe { &mut RB };
13+
let rb = unsafe { &mut *addr_of_mut!(RB) };
1414

1515
rb.enqueue(0).unwrap();
1616

@@ -31,7 +31,7 @@ fn once() {
3131
fn twice() {
3232
static mut RB: spsc::Queue<i32, 5> = spsc::Queue::new();
3333

34-
let rb = unsafe { &mut RB };
34+
let rb = unsafe { &mut *addr_of_mut!(RB) };
3535

3636
rb.enqueue(0).unwrap();
3737
rb.enqueue(1).unwrap();

0 commit comments

Comments
 (0)