From 022a7de26f5cb386ec853eec3b7f44dcd516a6d1 Mon Sep 17 00:00:00 2001 From: Phoebe Bell Date: Thu, 16 Jan 2020 19:26:02 -0800 Subject: [PATCH] Add SAFETY comment for atomic example --- src/libcore/sync/atomic.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libcore/sync/atomic.rs b/src/libcore/sync/atomic.rs index 8d55dc55ef2d6..9d449bb991507 100644 --- a/src/libcore/sync/atomic.rs +++ b/src/libcore/sync/atomic.rs @@ -1989,7 +1989,9 @@ extern { } let mut atomic = ", stringify!($atomic_type), "::new(1); -unsafe { +", +// SAFETY: Safe as long as `my_atomic_op` is atomic. +"unsafe { my_atomic_op(atomic.as_mut_ptr()); } # }