Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

optional r#type yields invalid identifier #174

Closed
oktal opened this issue Nov 7, 2024 · 2 comments · Fixed by #175
Closed

optional r#type yields invalid identifier #174

oktal opened this issue Nov 7, 2024 · 2 comments · Fixed by #175

Comments

@oktal
Copy link

oktal commented Nov 7, 2024

Hello,

I think I hit an edge-case that #9 does not properly handle.

The following struct definition:

enum VariableType {
    Flow,
    Temperature,
    Pressure,
}

#[derive(bon::Builder)]
struct Variable {
    r#type: Option<VariableType>,
    name: String,
    key: String,
}

Will panic with the following error:

proc-macro derive panicked
   message: `"maybe_r#type"` is not a valid identifier

It works if I remove the Option or rename my field to variable_type

A note for the community from the maintainers

Please vote on this issue by adding a 👍 reaction to help the maintainers with prioritizing it. You may add a comment describing your real use case related to this issue for us to better understand the problem domain.

@Veetaha
Copy link
Collaborator

Veetaha commented Nov 7, 2024

Thank you for reporting this!

The fix is pending a 3.0 release (#156)

@Veetaha
Copy link
Collaborator

Veetaha commented Nov 9, 2024

3.0.0-rc version was published. I'll prepare a blog post for the release and switch it to 3.0.0 on November 13-th

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants