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
GenericArray<T, N> requires that N implements ArrayLength<T> which is currently implemented like this:
pubunsafetraitArrayLength<T>:Unsigned{/// Associated type representing the array type for the numbertypeArrayType;}
However, , this is overly restrictive.
If you're working on any kind of trait which requires changing the GenericArray's element types, you end up with bounds like N: ArrayLength<T> + ArrayLength<S> + ArrayLength<R> + ....
But T is only used at the place where the ArrayType associated type is actually inspected, and otherwise completely unconstrainted.
As such, in modern Rust versions (I'm not sure what the MSRV is), we could change the trait to:
pubunsafetraitArrayLength:Unsigned{/// Associated type representing the array type for the numbertypeArrayType<T>;}
which captures the intent more clearly, and keeps bounds on N much simpler.
The text was updated successfully, but these errors were encountered:
GenericArray<T, N> requires that
N
implementsArrayLength<T>
which is currently implemented like this:However, , this is overly restrictive.
If you're working on any kind of trait which requires changing the GenericArray's element types, you end up with bounds like
N: ArrayLength<T> + ArrayLength<S> + ArrayLength<R> + ...
.But
T
is only used at the place where the ArrayType associated type is actually inspected, and otherwise completely unconstrainted.As such, in modern Rust versions (I'm not sure what the MSRV is), we could change the trait to:
which captures the intent more clearly, and keeps bounds on
N
much simpler.The text was updated successfully, but these errors were encountered: