diff options
| author | benjaminschlegel87 <[email protected]> | 2025-07-25 20:39:40 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-07-25 20:39:40 +0200 |
| commit | dbc1818acd69e2e15ac574356c9b07cb717df441 (patch) | |
| tree | 05e6360c1946183b524a1ce82268547fe4bbcfd0 /embassy-sync/tests/ui/sync_impl/lazy_lock_function.rs | |
| parent | adb728009ceba095d2190038ff698aaee08907a9 (diff) | |
| parent | 996974e313fa5ec2c7c2d9dd0998fab244c0a180 (diff) | |
Merge branch 'embassy-rs:main' into stm32_adc_v3_hw_oversampling_support
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) {} | ||
