On Mon Sep 28, 2026 at 5:42 PM JST, Eliot Courtney wrote:
<...>
> +impl<T, const N: usize> ArrayVec<T, N> {
> +    /// Creates an empty [`ArrayVec`].
> +    #[inline]
> +    pub const fn new() -> Self {
> +        // Clippy triggers this even if the enclosing function is never 
> called, so skip if clippy is
> +        // on.
> +        const_assert!(
> +            cfg!(clippy) || size_of::<Self>() <= 512,

Let's make this `512` a defined constant.

<...>
> +impl<I, E> From<PushInitError<I, E>> for Error
> +where
> +    Error: From<E>,
> +{
> +    #[inline]
> +    fn from(e: PushInitError<I, E>) -> Error {
> +        match e {
> +            PushInitError::Full(_) => EINVAL,
> +            PushInitError::InitError(e) => Error::from(e),
> +        }
> +    }
> +}
> +
> +/// Error type for [`ArrayVec::push_init`].
> +pub struct FullError;

This error type covers exactly the same pattern as `kvec::PushError`
(even the debug message is identical), can we somehow reuse that
instead? Or at least align the names by making this `PushInitError` and
`PushInitError` becoming `TryPushInitError` to reflect the actual names
of the methods using them.

Overall there are quite a few methods here that are still unused by the
end of the series, so this patch could technically have been smaller. I
think it's fine to keep these methods as they will inevitably become
useful, but it would be nice if we could simplify the error handling a
bit, or at least harmonize it.

Reply via email to