Skip to content
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

Tracking Issue for slice_swap_unchecked #88539

Open
2 of 4 tasks
ibraheemdev opened this issue Aug 31, 2021 · 1 comment
Open
2 of 4 tasks

Tracking Issue for slice_swap_unchecked #88539

ibraheemdev opened this issue Aug 31, 2021 · 1 comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@ibraheemdev
Copy link
Member

ibraheemdev commented Aug 31, 2021

Feature gate: #![feature(slice_swap_unchecked)]

This is a tracking issue for slice::swap_unchecked, an unsafe version of slice::swap that does not do bounds checking.

Public API

impl<T> [T] {
    pub unsafe fn swap_unchecked(&mut self, a: usize, b: usize);
}

Steps / History

Unresolved Questions

  • None yet.
@ibraheemdev ibraheemdev added C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Aug 31, 2021
@workingjubilee
Copy link
Contributor

workingjubilee commented Mar 6, 2022

This function seems pretty niche, not actually that hard to implement as unsafe code goes, and it seems doubtful it is going to have a lot of users, while it will add more noise to every single instance of the slice method documentation which is transcluded into... many other types. Is it really appropriate for std?

And if it was to make it easier for performance wins, it seems an unfounded assumption based on the idea that unsafe code is inherently faster (as opposed to potentially a blocker for optimization). The attempt to use it in std to implement swap was itself reverted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

2 participants