Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Fix cargo check for pallet-contracts-proc-macro #12706

Merged
merged 3 commits into from
Nov 16, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion frame/contracts/proc-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ proc-macro = true
[dependencies]
proc-macro2 = "1"
quote = "1"
syn = "1.0.98"
syn = { version = "1.0.98", features = ["full"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need full?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. By the error message we can note that cargo is failing to find lots of symbols which are only available if the full feature is enabled. See https://github.com/dtolnay/syn/blob/3424444c7f09a38b97bc2abcd086f7d48732fb51/src/lib.rs#L312-L454. I tried combining a few other features to no avail.

error[E0433]: failed to resolve: could not find `FnArg` in `syn`
   --> frame/contracts/proc-macro/src/lib.rs:286:9
    |
286 |             syn::FnArg::Typed(pt) => Some(&pt.ty),
    |                  ^^^^^ could not find `FnArg` in `syn`

error[E0433]: failed to resolve: could not find `Item` in `syn`
   --> frame/contracts/proc-macro/src/lib.rs:315:9
    |
315 |             syn::Item::Fn(i_fn) => Some(i_fn.clone()),
    |                  ^^^^ could not find `Item` in `syn`

error[E0433]: failed to resolve: could not find `FnArg` in `syn`
   --> frame/contracts/proc-macro/src/lib.rs:406:10
    |
406 |                 syn::FnArg::Typed(pt) => {
    |                      ^^^^^ could not find `FnArg` in `syn`

error[E0433]: failed to resolve: could not find `Pat` in `syn`
   --> frame/contracts/proc-macro/src/lib.rs:407:18
    |
407 |                     if let syn::Pat::Ident(ident) = &*pt.pat {
    |                                 ^^^ could not find `Pat` in `syn`

error[E0412]: cannot find type `ItemFn` in crate `syn`
   --> frame/contracts/proc-macro/src/lib.rs:158:13
    |
158 |     item: syn::ItemFn,
    |                ^^^^^^ not found in `syn`

error[E0412]: cannot find type `ItemFn` in crate `syn`
   --> frame/contracts/proc-macro/src/lib.rs:177:29
    |
177 |     pub fn try_from(item: syn::ItemFn) -> syn::Result<Self> {
    |                                ^^^^^^ not found in `syn`

error[E0412]: cannot find type `ItemMod` in crate `syn`
   --> frame/contracts/proc-macro/src/lib.rs:305:29
    |
305 |     pub fn try_from(item: syn::ItemMod) -> syn::Result<Self> {
    |                                ^^^^^^^ not found in `syn`

error[E0412]: cannot find type `Item` in crate `syn`
   --> frame/contracts/proc-macro/src/lib.rs:314:30
    |
314 |         let extract_fn = |i: &syn::Item| match i {
    |                                    ^^^^ not found in `syn`

error[E0412]: cannot find type `ItemMod` in crate `syn`
   --> frame/contracts/proc-macro/src/lib.rs:578:50
    |
578 |     let item = syn::parse_macro_input!(item as syn::ItemMod);
    |                                                     ^^^^^^^ not found in `syn`

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍


[dev-dependencies]

Expand Down