-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
The standard library type std::sync::OnceLock
is Eq
but not Hash
. From a theoretical and practical perspective, it should probably be both or neither.
The argument for neither is that the result of Eq
can change because of a different thread as soon as it is returned. Similarly, the value of Hash
can change between comparison of the Hash
and a follow up comparison with Eq
. Both of these are expected short-comings of types that can be changed by other threads.
The argument for both is that Hash
is fundamentally a property related to equality and not rules out usages in containers where there are some external invariants that guarantee the desired behavior.
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.T-libsRelevant to the library team, which will review and decide on the PR/issue.Relevant to the library team, which will review and decide on the PR/issue.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.