We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 60727ce commit c2655ebCopy full SHA for c2655eb
core/src/mem/mod.rs
@@ -736,7 +736,7 @@ pub const fn swap<T>(x: &mut T, y: &mut T) {
736
// tends to copy the whole thing to stack rather than doing it one part
737
// at a time, so instead treat them as one-element slices and piggy-back
738
// the slice optimizations that will split up the swaps.
739
- if size_of::<T>() / align_of::<T>() > 4 {
+ if const { size_of::<T>() / align_of::<T>() > 2 } {
740
// SAFETY: exclusive references always point to one non-overlapping
741
// element and are non-null and properly aligned.
742
return unsafe { ptr::swap_nonoverlapping(x, y, 1) };
0 commit comments