-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-arrayArea: `[T; N]`Area: `[T; N]`A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-sliceArea: `[T]`Area: `[T]`Libs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
Currently, we generate array impls for every size up to 32 manually using macros, but with const generics at a suitable level of implementation, we can switch to properly parameterising over all lengths.
- Replace most manual impls with const generic impls (PR: Use const generics for array impls [part 1] #62435)
- Replace
Default
impl with const generic impl (more difficult due to Switch libcore array implementations to const generics. #60466 (comment)). - Reimplement impls removed due to bloat using const generic impls (see
Lines 221 to 227 in 7840a0b
// NOTE: some less important impls are omitted to reduce code bloat __impl_slice_eq1! { [A; $N], [B; $N] } __impl_slice_eq2! { [A; $N], [B] } __impl_slice_eq2! { [A; $N], &'b [B] } __impl_slice_eq2! { [A; $N], &'b mut [B] } // __impl_slice_eq2! { [A; $N], &'b [B; $N] } // __impl_slice_eq2! { [A; $N], &'b mut [B; $N] } Lines 2199 to 2204 in bfdfa85
// NOTE: some less important impls are omitted to reduce code bloat // FIXME(Centril): Reconsider this? //__impl_slice_eq1! { [const N: usize] Vec<A>, &mut [B; N], [B; N]: LengthAtMost32 } //__impl_slice_eq1! { [const N: usize] Cow<'a, [A]>, [B; N], [B; N]: LengthAtMost32 } //__impl_slice_eq1! { [const N: usize] Cow<'a, [A]>, &[B; N], [B; N]: LengthAtMost32 } //__impl_slice_eq1! { [const N: usize] Cow<'a, [A]>, &mut [B; N], [B; N]: LengthAtMost32 }
stepancheg, goffrie, krircc, shankarshastri, bermanboris and 20 morescottmcm, mominul, wesleywiser, PvdBerg1998, pmarcelll and 20 moreest31, estebank, bb010g, cramertj, darksv and 23 moreschneiderfelipe, acheroncrypto and tequdev
Metadata
Metadata
Assignees
Labels
A-arrayArea: `[T; N]`Area: `[T; N]`A-const-genericsArea: const generics (parameters and arguments)Area: const generics (parameters and arguments)A-sliceArea: `[T]`Area: `[T]`Libs-TrackedLibs issues that are tracked on the team's project board.Libs issues that are tracked on the team's project board.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.T-langRelevant to the language teamRelevant to the language teamT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.