Closed Undin closed 6 years ago
This is fixed in 0.5.2 (sorry, this was fixed a little while ago, but I forgot to publish a new version).
I'm still having the same error message using derive-new 0.5.2
with the code @Undin supplied.
The error can also be reproduced with this smaller snippet:
#[macro_use] extern crate derive_new;
#[macro_use] extern crate serde_derive;
#[derive(new, Serialize)]
struct Struct {
field_a: u8,
#[serde(skip)]
field_b: u8,
}
Error:
error: proc-macro derive panicked
--> src/main.rs:4:10
|
4 | #[derive(new, Serialize)]
| ^^^
|
= help: message: Invalid #[new] attribute: #[new(skip)]
the code compiles just fine when the #[serde(skip)]
field attribute is removed.
Cargo.toml
used:
[dependencies]
derive-new = "0.5.2"
serde = "1.0.33"
serde_derive = "1.0.33"
Using
derive-new 0.5.1
got the following errorStruct definition: