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
error: TransparentWrapper must have one field of the wrapped type
--> src/lib.rs:5:10
|
5 | #[derive(bytemuck::TransparentWrapper)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: this error originates in the derive macro `bytemuck::TransparentWrapper` (in Nightly builds, run with -Z macro-backtrace for more info)
The text was updated successfully, but these errors were encountered:
In general, I don't really work on the proc-macros parts of the crate myself, so I don't know for sure, but https://github.com/Lokathor/bytemuck/blob/main/derive/src/traits.rs#L259 seems to be the code that decides what the wrapped type is when an argument is given. At a glance, it looks like the code will only pull one token from the stream iterator (which is assumed to be the type's ident), so it won't work with any types that use a generic (which looks like name < t >, four tokens).
This is not by design, it should work with generics, and I'd be happy to accept a PR that fixes this situation.
It appears that the derive macro for
TransparentWrapper
does not work with types likeBox
orOption
.I'm not sure if this is a bug or a feature request.
Minimal repro:
Expected reslut:
Foo: TransparentWrapper<Box<usize>>
Actual result:
The text was updated successfully, but these errors were encountered: