@@ -2166,10 +2166,12 @@ pub fn addr_eq<T: ?Sized, U: ?Sized>(p: *const T, q: *const U) -> bool {
21662166///
21672167/// This is the same as `f == g`, but using this function makes clear that the potentially
21682168/// surprising semantics of function pointer comparison are involved.
2169- /// There are very few guarantees about how functions are compiled and they have no intrinsic
2169+ ///
2170+ /// There are **very few guarantees** about how functions are compiled and they have no intrinsic
21702171/// “identity”; in particular, this comparison:
21712172///
21722173/// * May return `true` unexpectedly, in cases where functions are equivalent.
2174+ ///
21732175/// For example, the following program is likely (but not guaranteed) to print `(true, true)`
21742176/// when compiled with optimization:
21752177///
@@ -2182,6 +2184,7 @@ pub fn addr_eq<T: ?Sized, U: ?Sized>(p: *const T, q: *const U) -> bool {
21822184/// ```
21832185///
21842186/// * May return `false` in any case.
2187+ ///
21852188/// This is particularly likely with generic functions but may happen with any function.
21862189/// (From an implementation perspective, this is possible because functions may sometimes be
21872190/// processed more than once by the compiler, resulting in duplicate machine code.)
@@ -2207,7 +2210,6 @@ pub fn addr_eq<T: ?Sized, U: ?Sized>(p: *const T, q: *const U) -> bool {
22072210/// ```
22082211///
22092212/// [subtype]: https://doc.rust-lang.org/reference/subtyping.html
2210-
22112213#[ unstable( feature = "ptr_fn_addr_eq" , issue = "129322" ) ]
22122214#[ inline( always) ]
22132215#[ must_use = "function pointer comparison produces a value" ]
0 commit comments