Skip to content

Commit 47f4f94

Browse files
committed
Auto merge of #59527 - matklad:sized-index, r=<try>
remove ?Sized bounds from Index I've noticed that we have an `Idx: ?Sized` bound on the **index** in the `Index`, which seems strange given that we accept index by value. My guess is that it was meant to be removed in #23601, but was overlooked. If I remove this bound, `./x.py src/libstd/ src/libcore/` passes, which means at least that this is not covered by test. I think there's three things we can do here: * run crater with the bound removed to check if there are any regressions, and merge this, to be consistent with other operator traits * run crater, get regressions, write a test for this with a note that "hey, we tried to fix it, its unfixable" * decide, in the light of by-value DSTs, that this is a feature rather than a bug, and add a test cc @rust-lang/libs EDIT: the forth alternative is that there exist a genuine reason why this is the case, but I failed to see it :D
2 parents 003382e + a6b130e commit 47f4f94

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/libcore/ops/index.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#[doc(alias = "]")]
5959
#[doc(alias = "[")]
6060
#[doc(alias = "[]")]
61-
pub trait Index<Idx: ?Sized> {
61+
pub trait Index<Idx> {
6262
/// The returned type after indexing.
6363
#[stable(feature = "rust1", since = "1.0.0")]
6464
type Output: ?Sized;
@@ -163,7 +163,7 @@ see chapter in The Book <https://doc.rust-lang.org/book/ch08-02-strings.html#ind
163163
#[doc(alias = "[")]
164164
#[doc(alias = "]")]
165165
#[doc(alias = "[]")]
166-
pub trait IndexMut<Idx: ?Sized>: Index<Idx> {
166+
pub trait IndexMut<Idx>: Index<Idx> {
167167
/// Performs the mutable indexing (`container[index]`) operation.
168168
#[stable(feature = "rust1", since = "1.0.0")]
169169
fn index_mut(&mut self, index: Idx) -> &mut Self::Output;

0 commit comments

Comments
 (0)