osmosis-labs / osmosis-rust

Rust libraries for osmosis
Apache License 2.0
59 stars 52 forks source link

Remove private imports #72

Closed larry0x closed 1 year ago

larry0x commented 1 year ago

It seems proto-build imports some types from syn::__private. This might have worked before, but now we get:

cargo run -p proto-build
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
package:   /Users/larry/workspace/larry0x/osmosis-rust/tests/osmosis-std-cosmwasm-test/Cargo.toml
workspace: /Users/larry/workspace/larry0x/osmosis-rust/Cargo.toml
   Compiling proto-build v0.1.0 (/Users/larry/workspace/larry0x/osmosis-rust/packages/proto-build)
error[E0603]: struct `Group` is private
  --> packages/proto-build/src/transformers.rs:12:39
   |
12 | use syn::__private::quote::__private::Group;
   |                                       ^^^^^ private struct
   |
note: the struct `Group` is defined here
  --> /Users/larry/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.26/src/runtime.rs:6:19
   |
6  | use proc_macro2::{Group, Ident, Punct, Spacing, TokenTree};
   |                   ^^^^^

error[E0603]: enum `TokenTree` is private
  --> packages/proto-build/src/transformers.rs:14:39
   |
14 | use syn::__private::quote::__private::TokenTree;
   |                                       ^^^^^^^^^ private enum
   |
note: the enum `TokenTree` is defined here
  --> /Users/larry/.cargo/registry/src/github.com-1ecc6299db9ec823/quote-1.0.26/src/runtime.rs:6:49
   |
6  | use proc_macro2::{Group, Ident, Punct, Spacing, TokenTree};
   |                                                 ^^^^^^^^^

For more information about this error, try `rustc --explain E0603`.
error: could not compile `proto-build` due to 2 previous errors

Is there any specific reason that it imports from syn::__private?

If not, this PR switches imports to from proc-macro2 and quote instead.

iboss-ptk commented 1 year ago

No @larry0x ! nice catch. Not a good thing anyway to depend on something indicated as _private. I was unsure how should I handle them but this looks much better (and working..). Thank you!