File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -3423,6 +3423,18 @@ macro_rules! atomic_int {
3423
3423
/// }
3424
3424
/// # }
3425
3425
/// ```
3426
+ ///
3427
+ /// ```
3428
+ #[ doc = concat!( $extra_feature, "use std::sync::atomic::" , stringify!( $atomic_type) , ";" ) ]
3429
+ ///
3430
+ ///
3431
+ #[ doc = concat!( "let atomic_ref_1 = " , stringify!( $atomic_type) , "::new(1);" ) ]
3432
+ #[ doc = concat!( "let atomic_ref_2 = " , stringify!( $atomic_type) , "::new(2);" ) ]
3433
+ ///
3434
+ /// // Comparison of addresses is a safe operation and does not require an `unsafe` block.
3435
+ /// let is_equal = atomic_ref_1.as_ptr() == atomic_ref_2.as_ptr();
3436
+ /// assert!(is_equal || !is_equal);
3437
+ /// ```
3426
3438
#[ inline]
3427
3439
#[ stable( feature = "atomic_as_ptr" , since = "1.70.0" ) ]
3428
3440
#[ rustc_const_stable( feature = "atomic_as_ptr" , since = "1.70.0" ) ]
You can’t perform that action at this time.
0 commit comments