Skip to content

Tracking Issue for ptr::fn_addr_eq #129322

Closed

Description

@Urgau

Feature gate: #![feature(ptr_fn_addr_eq)]

This is a tracking issue for std::ptr::fn_addr_eq

Compares the addresses of the two function pointers for equality.

Public API

// core::ptr

/// Compares the *addresses* of the two function pointers for equality.
///
/// Function pointers comparisons can have surprising results since
/// they are never guaranteed to be unique and could vary between different
/// code generation units. Furthermore, different functions could have the
/// same address after being merged together.
///
/// This is the same as `f == g` but using this function makes clear
/// that you are aware of these potentially surprising semantics.
pub fn fn_addr_eq<T: FnPtr, U: FnPtr>(f: T, g: U) -> bool {
    f.addr() == g.addr()
}

Steps / History

Unresolved Questions

  • None yet.

Footnotes

  1. https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩

Activity

  1. added
    T-libs-api[DEPRECATED; DO NOT USE]
    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFC
    on Aug 20, 2024
  2. Urgau commented on Oct 17, 2024

    @Urgau
    MemberAuthor

    T-lang as started an FCP for adding a lint against function pointer comparisons and would like to use this method ptr::fn_addr_eq as recommendation to suppress the lint and hang documentation about caveats.

    Stabilization Report

    Implementation History

    API Summary

    // core::ptr
    
    /// Compares the *addresses* of the two function pointers for equality.
    ///
    /// Function pointers comparisons can have surprising results since
    /// they are never guaranteed to be unique and could vary between different
    /// code generation units. Furthermore, different functions could have the
    /// same address after being merged together.
    ///
    /// This is the same as `f == g` but using this function makes clear
    /// that you are aware of these potentially surprising semantics.
    pub fn fn_addr_eq<T: FnPtr, U: FnPtr>(f: T, g: U) -> bool {
        f.addr() == g.addr()
    }

    The std::marker::FnPtr bound

    The FnPtr marker trait is not stable and would be not stabilized by this FCP, but this commits us to having such trait (even in this unstable form).


    cc @rust-lang/lang (regarding the FnPtr bound)
    cc @rust-lang/libs-api

  3. dtolnay commented on Oct 17, 2024

    @dtolnay
    Member

    @rfcbot fcp merge

  4. rfcbot commented on Oct 17, 2024

    @rfcbot

    Team member @dtolnay has proposed to merge this. The next step is review by the rest of the tagged team members:

    No concerns currently listed.

    Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

    cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
    See this document for info about what commands tagged team members can give me.

  5. added
    proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
    disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.
    on Oct 17, 2024
  6. traviscross commented on Oct 17, 2024

    @traviscross
    Contributor

    @rfcbot reviewed

  7. added
    I-lang-nominatedNominated for discussion during a lang team meeting.
    I-lang-easy-decisionIssue: The decision needed by the team is conjectured to be easy; this does not imply nomination
    on Oct 17, 2024
  8. added a commit that references this issue on Oct 25, 2024
  9. added a commit that references this issue on Oct 25, 2024
  10. nikomatsakis commented on Oct 30, 2024

    @nikomatsakis
    Contributor

    @rfcbot reviewed

  11. traviscross commented on Oct 30, 2024

    @traviscross
    Contributor

    @rustbot labels -I-lang-nominated

    We discussed this in triage today. We've now unanimously checked off on the lang side. We appreciate @rust-lang/libs-api for moving this forward in support of the pending lang work.

  12. 1 remaining item

  13. added
    final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.
    on Nov 19, 2024
  14. rfcbot commented on Nov 19, 2024

    @rfcbot

    🔔 This is now entering its final comment period, as per the review above. 🔔

  15. removed
    proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
    on Nov 19, 2024
  16. added and removed
    final-comment-periodIn the final comment period and will be merged soon unless new substantive objections are raised.
    on Nov 29, 2024
  17. rfcbot commented on Nov 29, 2024

    @rfcbot

    The final comment period, with a disposition to merge, as per the review above, is now complete.

    As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

    This will be merged soon.

  18. added a commit that references this issue on Dec 2, 2024
  19. added a commit that references this issue on Dec 2, 2024
  20. added this to the 1.85.0 milestone on Dec 2, 2024
  21. added a commit that references this issue on Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCI-lang-easy-decisionIssue: The decision needed by the team is conjectured to be easy; this does not imply nominationT-langRelevant to the language teamT-libs-api[DEPRECATED; DO NOT USE]disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.finished-final-comment-periodThe final comment period is finished for this PR / Issue.

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions