Skip to content

Commit aaa6d3b

Browse files
committed
add comparison warning to RawWakerVTable as well
1 parent 1383657 commit aaa6d3b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

library/core/src/task/wake.rs

+6
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,12 @@ impl RawWaker {
9999
/// [`RawWaker`] implementation. Calling one of the contained functions using
100100
/// any other `data` pointer will cause undefined behavior.
101101
///
102+
/// Note that while this type implements `PartialEq`, comparing function pointers, and hence
103+
/// comparing structs like this that contain function pointers, is unreliable: pointers to the same
104+
/// function can compare inequal (because functions are duplicated in multiple codegen units), and
105+
/// pointers to *different* functions can compare equal (since identical functions can be
106+
/// deduplicated within a codegen unit).
107+
///
102108
/// # Thread safety
103109
/// If the [`RawWaker`] will be used to construct a [`Waker`] then
104110
/// these functions must all be thread-safe (even though [`RawWaker`] is

0 commit comments

Comments
 (0)