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

Problem with a declarative macro #59

Closed
fecetrulo opened this issue Nov 4, 2020 · 3 comments
Closed

Problem with a declarative macro #59

fecetrulo opened this issue Nov 4, 2020 · 3 comments
Milestone

Comments

@fecetrulo
Copy link

fecetrulo commented Nov 4, 2020

I couldn't make JsonSchema derive works with a macro that creates structs and a enum containing these structures. I keep getting an error cannot find value gen in this scope.

I made a gist showing a minimal example where the problem occurs.

If the JsonSchema derive is commented on macro's call, the code works just fine.

Error
error[E0425]: cannot find value `gen` in this scope
  --> src/main.rs:27:24
   |
27 |                   $inner($inner)
   |                          ^^^^^^ not found in this scope
...
36 | / _macro!(
37 | |     #[derive(Serialize, Deserialize, Debug, JsonSchema)]
38 | |     Test {
39 | |         #[derive(Serialize, Deserialize, Debug, JsonSchema)]
...  |
42 | |
43 | | );
   | |__- in this macro invocation
   |
   = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)

@Kixiron
Copy link

Kixiron commented Dec 17, 2020

This happened to me, it seemed to occur when syn bumped from v1.0.48 to v1.0.54

@GREsau
Copy link
Owner

GREsau commented Apr 5, 2021

Thanks for the report, this is the same as #66 and will be fixed in the next version of schemars 🙂

@GREsau GREsau added this to the v0.8.3 milestone Apr 5, 2021
@GREsau
Copy link
Owner

GREsau commented Apr 5, 2021

Fixed in v0.8.3 - https://crates.io/crates/schemars/0.8.3

@GREsau GREsau closed this as completed Apr 5, 2021
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

No branches or pull requests

3 participants