-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add slice_at #18066
add slice_at #18066
Conversation
This is modifying a trait in the prelude, and there is no rationale here other than "add slice_at". Could you expand the description, title, or commit message to explain the reasoning for adding a new method like this? This will also need some tests in order to be merged as well. |
This doesn't strike me as well-motivated. It is hardly a burden to do this with existing methods, as the implementations show. We're trying to reduce the api surface area right now. If this is really desirable, I think it can be re-evaluated after 1.0. |
@gankro: How can slice_to be fine if this is not? Are you suggesting removing slice_to? That one even has a replacement with the new slicing syntax while slice_at does not. @alexcrichton: Can you point me to the rationale for adding slice_to/from/etc.? I'm sure very similar justifications apply here. |
I assume those will be deprecated by the slicing syntax when it's stable. However I haven't been following stabalization of slices (which I think was discussed privately during the last work-week?) CC @aturon |
Yes, the slice methods are going to be deprecated once slice syntax is un-feature-gated. We've discussed providing separate non-failing slice methods, but I don't think we're going to do that. I agree that this convenience doesn't seem so well-motivated. You could make a stronger argument for it by showing some data about how often |
How slice_to, slice_from or the [..n] and [n..] syntax could ever be added but tailn gets deprecated and this function gets rejected as not motivated (even though they are much more orthogonal and often cannot be replaced without creating more noise in the code) is beyond me. Have it your way. |
@mahkoh To be clear, no one was saying that this would be rejected out of hand, just that we wanted to discuss the motivation and impact. As I suggested, it'd be interesting to collect some data on how these methods are actually being used in practice. I'm not sure I follow the argument about The slice notation and functions we're using have a massive precedent in other languages, and the notation in particular was discussed in an RFC. In general we encourage constructive feedback and discussion, and are quite willing to change our minds on things! |
Also: unlike some other languages, a method not being included in the core definition does not prevent a library from implementing their favourite conveniences using an extension trait. If you find that you use |
fix: Don't panic lsp writer thread on dropped receiver Should reduce the noise a bit (rust-lang/rust-analyzer#18055). This removes the panic (and a follow up panic) when the server incorrectly shuts down, turning it into a proper late exit error.
No description provided.