mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
Fix unintended regression for Freeze + Copy types
Freeze + Copy types should be allowed to choose between all three small-sort variants. With the recent changes to small-sort selection, a regression was added that only let such types choose between network and fallback. It can now also choose general where appropriate.
This commit is contained in:
parent
24697ac66b
commit
032ad4c4c6
@ -146,7 +146,9 @@ impl<T: FreezeMarker + CopyMarker> UnstableSmallSortFreezeTypeImpl for T {
|
||||
if has_efficient_in_place_swap::<T>()
|
||||
&& (mem::size_of::<T>() * SMALL_SORT_NETWORK_SCRATCH_LEN) <= MAX_STACK_ARRAY_SIZE
|
||||
{
|
||||
SMALL_SORT_NETWORK_SCRATCH_LEN
|
||||
SMALL_SORT_NETWORK_THRESHOLD
|
||||
} else if (mem::size_of::<T>() * SMALL_SORT_GENERAL_SCRATCH_LEN) <= MAX_STACK_ARRAY_SIZE {
|
||||
SMALL_SORT_GENERAL_THRESHOLD
|
||||
} else {
|
||||
SMALL_SORT_FALLBACK_THRESHOLD
|
||||
}
|
||||
@ -161,6 +163,8 @@ impl<T: FreezeMarker + CopyMarker> UnstableSmallSortFreezeTypeImpl for T {
|
||||
&& (mem::size_of::<T>() * SMALL_SORT_NETWORK_SCRATCH_LEN) <= MAX_STACK_ARRAY_SIZE
|
||||
{
|
||||
small_sort_network(v, is_less);
|
||||
} else if (mem::size_of::<T>() * SMALL_SORT_GENERAL_SCRATCH_LEN) <= MAX_STACK_ARRAY_SIZE {
|
||||
small_sort_general(v, is_less);
|
||||
} else {
|
||||
small_sort_fallback(v, is_less);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user