-
Notifications
You must be signed in to change notification settings - Fork 24
Closed
Labels
ACP-acceptedAPI Change Proposal is accepted (seconded with no objections)API Change Proposal is accepted (seconded with no objections)T-libs-apiapi-change-proposalA proposal to add or alter unstable APIs in the standard librariesA proposal to add or alter unstable APIs in the standard libraries
Description
Proposal
Problem statement
Comparing Boxs that are allocated by different allocators via PartialEq or PartialOrd is not currently possible.
Motivating examples or use cases
- It is consistent with
PartialEq<Vec<U, A2>> for Vec<T, A1>. - I'm writing a library that uses a specific allocator internally. For tests, I'd like to be able to declaratively define data that is
expected, and compare it with data that Igot. Resorting toDeref<Target = T>and comparing individual fields may be very tedious in cases when the data in question contains several layers of types internally, and especially enums.
Solution sketch
See PR: rust-lang/rust#112628
Alternatives
- Compare
Boxs viaDeref<Target = T>. - Make sure to use the same allocator everywhere.
Metadata
Metadata
Assignees
Labels
ACP-acceptedAPI Change Proposal is accepted (seconded with no objections)API Change Proposal is accepted (seconded with no objections)T-libs-apiapi-change-proposalA proposal to add or alter unstable APIs in the standard librariesA proposal to add or alter unstable APIs in the standard libraries