-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Implement Index
for SliceIndex
types for str
#55603
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
cc @rust-lang/libs |
The bounds on https://doc.rust-lang.org/std/primitive.slice.html#method.get |
Perhaps @alercah meant for |
Ah, yes, I did. I mistakenly assumed they are in fact the same. :) |
Ah yeah, that seems like an oversight! |
Index
for SliceIndex
typesIndex
for SliceIndex
types for str
This was missed by accident when the initial implementation landed! Closes #55603
Use SliceIndex for str's Index/IndexMut impls This was missed by accident when the initial implementation landed! Closes #55603
Make `str` indexing generic on `SliceIndex`. Fixes rust-lang#55603
While writing a generic implementation today, I was surprised that you can't do
s[i]
fori: SliceIndex<S>
, ifs
is of slice type&S
. Doings.get(i).unwrap()
is an easy enough workaround, but feels really bad. Replacing the various explicit impls with one forSliceIndex
would feel much nicer.The text was updated successfully, but these errors were encountered: