diff options
| author | Ralf Jung <post@ralfj.de> | 2024-02-11 23:06:09 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2024-02-11 23:06:09 +0100 |
| commit | aaa6d3bec2d08f425c844f5964782e1d6a1bbc88 (patch) | |
| tree | 959b7310fd5ced48ef7d5f3a006c3cfbc29a466f | |
| parent | 1383657a46a2b4052ceaf066942145b3799d8677 (diff) | |
| download | rust-aaa6d3bec2d08f425c844f5964782e1d6a1bbc88.tar.gz rust-aaa6d3bec2d08f425c844f5964782e1d6a1bbc88.zip | |
add comparison warning to RawWakerVTable as well
| -rw-r--r-- | library/core/src/task/wake.rs | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs index 9ad71e394ea..09f3f2f02ea 100644 --- a/library/core/src/task/wake.rs +++ b/library/core/src/task/wake.rs @@ -99,6 +99,12 @@ impl RawWaker { /// [`RawWaker`] implementation. Calling one of the contained functions using /// 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 /// If the [`RawWaker`] will be used to construct a [`Waker`] then /// these functions must all be thread-safe (even though [`RawWaker`] is |
