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
Which has no problems if I just write it like that instead of using generics. But the generic version gives this error:
error[E0277]: the trait bound `T: std::marker::Sized` is not satisfied
--> src/main.rs:14:25
|
14 | let tmp = [0u8; mem::size_of::<T>()];
| ^^^^^^^^^^^^^^^^^ `T` does not have a constant size known at compile-time
|
= help: the trait `std::marker::Sized` is not implemented for `T`
= help: consider adding a `where T: std::marker::Sized` bound
= note: required by `std::mem::size_of`
I'm not sure if this use case is intended to be supported. But, even if it isn't, the error message is very bad, since T: Sized should always be an implied constraint here.
The text was updated successfully, but these errors were encountered:
See playground.
I have a function like this:
Which, in this usage, I'd expect to be monomorphised like this:
Which has no problems if I just write it like that instead of using generics. But the generic version gives this error:
I'm not sure if this use case is intended to be supported. But, even if it isn't, the error message is very bad, since
T: Sized
should always be an implied constraint here.The text was updated successfully, but these errors were encountered: