You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// FIXME(const-hack): We would like to simply use iterators for this (as in the original implementation), but this is not allowed in constant expressions.
616
+
letmut i = 0;
617
+
while i < N{
618
+
buf[i] = &rawconstself[i];
619
+
620
+
i += 1;
621
+
}
622
+
623
+
// SAFETY: `*const T` has the same layout as `&T`, and we've also initialised each pointer as a valid reference.
624
+
unsafe{transmute_unchecked(buf)}
611
625
}
612
626
613
627
/// Borrows each element mutably and returns an array of mutable references
// FIXME(const-hack): We would like to simply use iterators for this (as in the original implementation), but this is not allowed in constant expressions.
647
+
letmut i = 0;
648
+
while i < N{
649
+
buf[i] = &rawmutself[i];
650
+
651
+
i += 1;
652
+
}
653
+
654
+
// SAFETY: `*mut T` has the same layout as `&mut T`, and we've also initialised each pointer as a valid reference.
655
+
unsafe{transmute_unchecked(buf)}
630
656
}
631
657
632
658
/// Divides one array reference into two at an index.
0 commit comments