Description
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
- Implementation: Implement
ptr::fn_addr_eq
#129323 and Expandptr::fn_addr_eq()
documentation. #131457Final comment period (FCP)1Stabilization PR
Unresolved Questions
- None yet.
Footnotes
Metadata
Metadata
Assignees
Labels
Category: An issue tracking the progress of sth. like the implementation of an RFCIssue: The decision needed by the team is conjectured to be easy; this does not imply nominationRelevant to the language teamRelevant to the library API team, which will review and decide on the PR/issue.This issue / PR is in PFCP or FCP with a disposition to merge it.The final comment period is finished for this PR / Issue.
Activity
ptr::fn_addr_eq()
documentation. #131457Urgau commentedon Oct 17, 2024
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
ptr::fn_addr_eq
#129323ptr::fn_addr_eq()
documentation. #131457(waiting on review, but doesn't prevent FCP)API Summary
The
std::marker::FnPtr
boundThe
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
dtolnay commentedon Oct 17, 2024
@rfcbot fcp merge
rfcbot commentedon Oct 17, 2024
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.
traviscross commentedon Oct 17, 2024
@rfcbot reviewed
Rollup merge of rust-lang#131457 - kpreid:fnaddr, r=dtolnay
Unrolled build for rust-lang#131457
21 remaining items