add comparison warning to RawWakerVTable as well

This commit is contained in:
Ralf Jung 2024-02-11 23:06:09 +01:00
parent 1383657a46
commit aaa6d3bec2

View File

@ -99,6 +99,12 @@ pub fn vtable(&self) -> &'static RawWakerVTable {
/// [`RawWaker`] implementation. Calling one of the contained functions using /// [`RawWaker`] implementation. Calling one of the contained functions using
/// any other `data` pointer will cause undefined behavior. /// any other `data` pointer will cause undefined behavior.
/// ///
/// Note that while this type implements `PartialEq`, comparing function pointers, and hence
/// comparing structs like this that contain function pointers, is unreliable: pointers to the same
/// function can compare inequal (because functions are duplicated in multiple codegen units), and
/// pointers to *different* functions can compare equal (since identical functions can be
/// deduplicated within a codegen unit).
///
/// # Thread safety /// # Thread safety
/// If the [`RawWaker`] will be used to construct a [`Waker`] then /// If the [`RawWaker`] will be used to construct a [`Waker`] then
/// these functions must all be thread-safe (even though [`RawWaker`] is /// these functions must all be thread-safe (even though [`RawWaker`] is