Marwes / schemafy

Crate for generating rust types from a json schema
MIT License
242 stars 51 forks source link

use of undeclared type or module `proc_macro` #38

Closed mismosmi closed 4 years ago

mismosmi commented 4 years ago

When trying to install schemafy using cargo install schemafy I see the following error:

error[E0433]: failed to resolve: use of undeclared type or module `proc_macro`
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.5.1/src/lib.rs:83:39
   |
83 |     fn build_tokens(mut self, tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
   |                                       ^^^^^^^^^^ use of undeclared type or module `proc_macro`

error[E0433]: failed to resolve: use of undeclared type or module `proc_macro`
  --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.5.1/src/lib.rs:83:67
   |
83 |     fn build_tokens(mut self, tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
   |                                                                   ^^^^^^^^^^ use of undeclared type or module `proc_macro`

error[E0433]: failed to resolve: use of undeclared type or module `proc_macro`
   --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.5.1/src/lib.rs:157:25
    |
157 | pub fn schemafy(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
    |                         ^^^^^^^^^^ use of undeclared type or module `proc_macro`

error[E0433]: failed to resolve: use of undeclared type or module `proc_macro`
   --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.5.1/src/lib.rs:157:53
    |
157 | pub fn schemafy(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
    |                                                     ^^^^^^^^^^ use of undeclared type or module `proc_macro`

error[E0433]: failed to resolve: use of undeclared type or module `proc_macro`
   --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.5.1/src/lib.rs:166:27
    |
166 | pub fn regenerate(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
    |                           ^^^^^^^^^^ use of undeclared type or module `proc_macro`

error[E0433]: failed to resolve: use of undeclared type or module `proc_macro`
   --> /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/schemafy-0.5.1/src/lib.rs:166:55
    |
166 | pub fn regenerate(tokens: proc_macro::TokenStream) -> proc_macro::TokenStream {
    |                                                       ^^^^^^^^^^ use of undeclared type or module `proc_macro`

error: aborting due to 6 previous errors

Simply replacing proc_macro with proc_macro2 in src/lib.rs sadly did not cut it.

Best, Michel

mismosmi commented 4 years ago

My mistake, I was using a rust version from the stone age.