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 {
34233423 /// }
34243424 /// # }
34253425 /// ```
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+ /// ```
34263438 #[ inline]
34273439 #[ stable( feature = "atomic_as_ptr" , since = "1.70.0" ) ]
34283440 #[ rustc_const_stable( feature = "atomic_as_ptr" , since = "1.70.0" ) ]
You can’t perform that action at this time.
0 commit comments