diff options
| author | 1-rafael-1 <[email protected]> | 2025-09-15 20:07:18 +0200 |
|---|---|---|
| committer | 1-rafael-1 <[email protected]> | 2025-09-15 20:07:18 +0200 |
| commit | 6bb3d2c0720fa082f27d3cdb70f516058497ec87 (patch) | |
| tree | 5a1e255cff999b00800f203b91a759c720c973e5 /embassy-sync/tests/ui/sync_impl/lazy_lock_function.rs | |
| parent | eb685574601d98c44faed9a3534d056199b46e20 (diff) | |
| parent | 92a6fd2946f2cbb15359290f68aa360953da2ff7 (diff) | |
Merge branch 'main' into rp2040-rtc-alarm
Diffstat (limited to 'embassy-sync/tests/ui/sync_impl/lazy_lock_function.rs')
| -rw-r--r-- | embassy-sync/tests/ui/sync_impl/lazy_lock_function.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/embassy-sync/tests/ui/sync_impl/lazy_lock_function.rs b/embassy-sync/tests/ui/sync_impl/lazy_lock_function.rs new file mode 100644 index 000000000..35f5587c0 --- /dev/null +++ b/embassy-sync/tests/ui/sync_impl/lazy_lock_function.rs | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | use embassy_sync::lazy_lock::LazyLock; | ||
| 2 | |||
| 3 | fn main() { | ||
| 4 | let x = 128u8; | ||
| 5 | let x_ptr: *const u8 = core::ptr::addr_of!(x); | ||
| 6 | let closure_capturing_non_sync_variable = || unsafe { core::ptr::read(x_ptr) }; | ||
| 7 | |||
| 8 | check_sync(LazyLock::new(closure_capturing_non_sync_variable)); | ||
| 9 | } | ||
| 10 | |||
| 11 | fn check_sync<T: Sync>(_lazy_lock: T) {} | ||
