(As seen your the linked issue).
Yes, but various comments are able to get this sort of thing to work in ways the are not yet displayed in here or in original post. As an example,
fn split_first<T, const N: usize>(arr: [T; N]) -> (T, [T; N - 1]) {
let arr = mem::ManuallyDrop::new(arr);
unsafe {
let head = ptr::read(&arr[0]);
let tail = ptr::read(&arr[1..] as *const [T] as *const [T; N - 1]);
(head, tail)
}
}
though the test()
example unconstrained generic constant
and asking for where
clauses?
yet
So back to above, what is the best way to follow this? Searching by Github issue labels not particularly helpful and though some of the recent links are somewhat helpful (operations on const generic parameters are permitted in certain examples), but still not clear about how to use upstream const generic parameters operations. Is this the type of feature where needing knowledge of rustc to follow discussions?
Thankful for all your attentive responses, but if there is a place that may be better to ask this question, open to go there.
edit: To clarity, still unclear if using the approach from the linked issue is appropriate in the the original example. This is where relevant unconstrained generic constant
This may work.
Thanks again for your help @RustyYato. New thread for cycle detected when building an abstract representation
.