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
{{ message }}
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
I'm trying to add bincode to musli benchmarks, and I want to derive Decode on something like the following:
use bincode::Decode;#[derive(Decode)]pubstructMesh<V:AsRef<[Triangle]> = Vec<Triangle>>{pubtriangles:V,}#[derive(Decode)]structTriangle{x:u32,y:u32,z:u32,}
I see this:
Compile errors
error: generic parameters with a default must be trailing
--> tests/examples/bincode-derive.rs:4:17
|
4 | pub struct Mesh<V: AsRef<[Triangle]> = Vec<Triangle>> {
| ^
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
--> tests/examples/bincode-derive.rs:4:17
|
4 | pub struct Mesh<V: AsRef<[Triangle]> = Vec<Triangle>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
= note: `#[deny(invalid_type_param_default)]` on by default
error: defaults for type parameters are only allowed in `struct`, `enum`, `type`, or `trait` definitions
--> tests/examples/bincode-derive.rs:4:17
|
4 | pub struct Mesh<V: AsRef<[Triangle]> = Vec<Triangle>> {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #36887 <https://github.com/rust-lang/rust/issues/36887>
error: could not compile `tests` (example "bincode-derive") due to 5 previous errors
In my mind, it should be possible to derive this, all though ultimately the Decode implementation would have to be conditional on implementing Decode, either implicitly or explicitly with bounds parameters.
I'm trying to add bincode to musli benchmarks, and I want to derive
Decodeon something like the following:I see this:
Compile errors
In my mind, it should be possible to derive this, all though ultimately the
Decodeimplementation would have to be conditional on implementingDecode, either implicitly or explicitly with bounds parameters.Reference: udoprog/musli#266