-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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::array_chunks
#72334
Conversation
Oh! I remember the compiler got a little wonky when I also remember it was a little less wonky when using a freestanding function as I wrote in #60735 (comment). Perhaps it's something to investigate if we want this feature to (finally) be usable in nightly? However I found the free standing function a bit of a downside if it goes for how the resulting code looks at userlevel. |
To be fair, the compiler is always a little wonky atm 😆 Free standing functions work as For
|
Can we make it a method, but enforce function style calling for now? Mainly I find it concerning that when called as method, rustc ICE's. I don't think its good for libcore to have code that crashes rustc when called 'wrong' |
Wish this to happen at compile-time. |
Sadly not, as So even if we change |
I'm going to mark this as a draft for now, because I don't think we're ready to add this even unstably yet, when it's too prone to ICEing. Hopefully we'll be able to get the remaining issues ironed out before too long. |
@rustbot modify labels to S-waiting-on-author -S-waiting-on-review |
I'm going to close this. Leaving it open will just accumulate conflicts and things may change in the future. Better to create a new PR when revisiting it. |
Reopened as #74373. |
add `slice::array_chunks` to std Now that rust-lang#74113 has landed, these methods are suddenly usable. A rebirth of rust-lang#72334 Tests are directly copied from `chunks_exact` and some additional tests for type inference. r? @withoutboats as you are both part of t-libs and working on const generics. closes rust-lang#60735
adds a currently somewhat unuseable implementation of #60735.
cc @DutchGhost
I am not sure if this does more harm than good by showing it in the stable docs, but this felt like a nice challenge of my knowledge of the current state of const generics.
r? @varkor for the const generics bit
edit: the biggest problem is #71154, which prevents all uses of
slice.array_chunks::<{expr}>()
and some type inference stuff which may already be fixed on the currently nightly