Remove ?Sized bound from Idx in Index and IndexMut#157736
Conversation
`Idx: ?Sized` is useless because the trait methods pass the index by value, so it's impossible to impl with an unsized Idx type. Removing this makes it a little easier for learners to understand the intent of the Index and IndexMut traits.
|
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @jhpratt (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
Why was this reviewer chosen?The reviewer was selected based on:
|
|
The job Click to see the possible cause of the failure (guessed by this bot) |
|
See #48055 for supporting unsized function parameters. While there is RFC 3829 that may remove that (it's not clear whether it's only locals or also arguments), that RFC is not yet accepted. Because unsized locals are still formally accepted, I'll be closing this. With that said, don't be discouraged! You're absolutely right that on stable the relaxed bound is unnecessary. |
Idx: ?Sizedis useless because the trait methods pass the index by value, so it's impossible to impl with an unsized Idx type.Removing this makes it a little easier for learners to understand the intent of the Index and IndexMut traits.