Open
Description
I tried this code:
fn foo<T: AsMut<[u8; 12]>>(mut t: T) {
t.as_mut()[0] = 0;
}
fn bar(x: &mut [u8; 12]) {
foo(x);
}
I expected it to compile.
Instead, this happened:
error[E0277]: the trait bound `[u8; 12]: AsMut<[u8; 12]>` is not satisfied
--> crate/src/it.rs:5:9
|
5 | foo(x);
| --- ^ the trait `AsMut<[u8; 12]>` is not implemented for `[u8; 12]`, which is required by `&mut [u8; 12]: AsMut<[u8; 12]>`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `AsMut<T>`:
[T; N]
[T]
= note: required for `&mut [u8; 12]` to implement `AsMut<[u8; 12]>`
note: required by a bound in `foo`
--> crate/src/it.rs:1:11
|
1 | fn foo<T: AsMut<[u8; 12]>>(mut t: T) {
| ^^^^^^^^^^^^^^^ required by this bound in `foo`