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

cast failing to compile #464

Closed
totlsota opened this issue Jan 15, 2022 · 2 comments · Fixed by #465
Closed

cast failing to compile #464

totlsota opened this issue Jan 15, 2022 · 2 comments · Fixed by #465

Comments

@totlsota
Copy link

OS:

Mac 11.5

Install command

cargo install --git https://github.com/gakonst/foundry --bin cast  

Issue:

cast fails to compile with error below

forge binary builds and runs fine

Error trace


Compiling ethers-solc v0.1.0 (https://github.com/gakonst/ethers-rs#77dcccb7)
error[E0023]: this pattern has 3 fields, but the corresponding tuple variant has 4 fields
   --> .cargo/git/checkouts/ethers-rs-c3a7c0a0ae0fe6be/77dcccb/ethers-solc/src/resolver.rs:426:53
    |
426 |                     SourceUnitPart::PragmaDirective(_, pragma, value) => {
    |                                                     ^  ^^^^^^  ^^^^^ expected 4 fields, found 3
    |
   ::: .cargo/git/checkouts/solang-98203f5abd7a90ef/747e524/solang-parser/src/pt.rs:58:21
    |
58  |     PragmaDirective(Loc, Vec<DocComment>, Identifier, StringLiteral),
    |                     ---  ---------------  ----------  ------------- tuple variant has 4 fields
    |
help: use `_` to explicitly ignore each field
    |
426 |                     SourceUnitPart::PragmaDirective(_, pragma, value, _) => {
    |                                                                     +++

For more information about this error, try `rustc --explain E0023`.
error: could not compile `ethers-solc` due to previous error
warning: build failed, waiting for other jobs to finish...
error: failed to compile `foundry-cli v0.1.0 (https://github.com/gakonst/foundry#c0e534c0)`, 
@youngkidwarrior
Copy link

youngkidwarrior commented Jan 15, 2022

It seems this change to ethers-rs is the cause

Add Location To Solidity Pragma Directive (#638)

add loc to pragma directive
PragmaDirective(Loc, Vec<DocComment>, Identifier, StringLiteral),

Here is a short term fix, until foundry guys release an official fix

  1. Open ethers-solc resolver for current install

/Users/$USER/.cargo/git/checkouts/ethers-rs-c3a7c0a0ae0fe6be/93878e4/ethers-solc/src/resolver.rs

  1. Change Line 426:

    SourceUnitPart::PragmaDirective(_, pragma, value) => {

    to

    SourceUnitPart::PragmaDirective(_, _, pragma, value) => {

  2. Run cast install command

    cargo install --git https://github.com/gakonst/foundry --bin cast

@mattsse
Copy link
Member

mattsse commented Jan 15, 2022

there was a breaking change on solang-parser

fixed on ethers-rs here, gakonst/ethers-rs#796

then needs a cargo update -p ethers here

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.

3 participants