8000 od: warning: function pointer comparisons do not produce meaningful results · Issue #7187 · uutils/coreutils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
od: warning: function pointer comparisons do not produce meaningful results #7187
Closed
@ic3man5

Description

@ic3man5

This might be a false positive, I had nightly defaulted by accident and ran across this warning. Stable 1.84 doesn't display this warning.

 rustc --version
rustc 1.86.0-nightly (824759493 2025-01-09)
   Compiling uu_sum v0.0.29 (/home/drebbe/dev/coreutils/src/uu/sum)
warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
  --> src/uu/od/src/formatteriteminfo.rs:29:45
   |
29 |             (IntWriter(a), IntWriter(b)) => a == b,
   |                                             ^^^^^^
   |
   = note: the address of the same function can vary between different codegen units
   = note: furthermore, different functions could have the same address after being merged together
   = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html>
   = note: `#[warn(unpredictable_function_pointer_comparisons)]` on by default
help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint
   |
29 |             (IntWriter(a), IntWriter(b)) => std::ptr::fn_addr_eq(*a, *b),
   |                                             ++++++++++++++++++++++ ~~~ +

warning: function pointer comparisons do not produce meaningful results since their addresses are not guaranteed to be unique
  --> src/uu/od/src/formatteriteminfo.rs:30:49
   |
30 |             (FloatWriter(a), FloatWriter(b)) => a == b,
   |                                                 ^^^^^^
   |
   = note: the address of the same function can vary between different codegen units
   = note: furthermore, different functions could have the same address after being merged together
   = note: for more information visit <https://doc.rust-lang.org/nightly/core/ptr/fn.fn_addr_eq.html>
help: refactor your code, or use `std::ptr::fn_addr_eq` to suppress the lint
   |
30 |             (FloatWriter(a), FloatWriter(b)) => std::ptr::fn_addr_eq(*a, *b),
   |                                                 ++++++++++++++++++++++ ~~~ +

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0