impl PartialOrd<[U]> for [T]
#129039
Labels
C-tracking-issue
Category: An issue tracking the progress of sth. like the implementation of an RFC
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
This has an accepted ACP, but I'm going to file a separate issue here since I was having issues implementing it and don't want to forget about it. (Like I have for the past year.)
Essentially, the primary issue is the way we go about specializing
PartialOrd
for slices, which is not symmetric with the way we go about specializingPartialEq
for slices.Right now,
PartialEq<[U]> for [T]
relies on a correspondingSlicePartialEq<U> for [T]
, and there's no issue.However, because
Ord
doesn't have a generic parameter,SlicePartialOrd
also doesn't, and this means that we can't actually specializePartialOrd<[U]> for [T]
. And I don't really know how to fix things without breaking the existing optimizations in the standard library, which is why I haven't touched this yet.All the relevant code is in
library/core/src/slice/cmp.rs
:The main issue is this impl here:
Which essentially requires that
SlicePartialOrd
not have a generic parameter, sinceSliceOrd
andOrd
don't.The text was updated successfully, but these errors were encountered: