blob: c6e6f7e645af099294d46a5f55d1a005d6b8210e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
use embassy_sync::lazy_lock::LazyLock;
fn main() {
let x = 128u8;
let x_ptr: *const u8 = core::ptr::addr_of!(x);
let closure_capturing_non_sync_variable = || {
unsafe {
core::ptr::read(x_ptr)
}
};
// This should fail to compile because the closure captures a non-Sync variable: x_ptr.
let _lazy_u8: LazyLock<u8, _> = LazyLock::new(closure_capturing_non_sync_variable);
}
|