Skip to content

Cannot compile v0.19.0 with Rust v1.77 on Mac #726

Description

@ababo

Here is the output I got:

    Checking web3 v0.19.0
error[E0308]: `match` arms have incompatible types
  --> /Users/ababo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/web3-0.19.0/src/api/accounts.rs:79:37
   |
77 | /                         match $o {
78 | |                             Some(value) => Ok(value),
   | |                                            --------- this is found to be of type `std::result::Result<U256, _>`
79 | |                             None => $f.await,
   | |                                     ^^^^^^^^ expected `Result<U256, _>`, found `U256`
80 | |                         }
   | |_________________________- `match` arms have incompatible types
...
95 |                   maybe!(gas_price, self.web3().eth().gas_price()),
   |                   ------------------------------------------------ in this macro invocation
   |
   = note: expected enum `std::result::Result<U256, _>`
            found struct `U256`
   = note: this error originates in the macro `maybe` (in Nightly builds, run with -Z macro-backtrace for more info)
help: try wrapping the expression in a variant of `std::result::Result`
   |
79 |                             None => Ok($f.await),
   |                                     +++        +
79 |                             None => Err($f.await),
   |                                     ++++        +

error[E0277]: the `?` operator can only be used in an async function that returns `Result` or `Option` (or another type that implements `FromResidual`)
  --> /Users/ababo/.cargo/registry/src/index.crates.io-6f17d22bba15001f/web3-0.19.0/src/api/eth.rs:91:90
   |
90 |       pub async fn gas_price(&self) -> U256 {
   |  ___________________________________________-
91 | |         let price = CallFuture::new(self.transport.execute("eth_gasPrice", vec![])).await?;
   | |                                                                                          ^ cannot use the `?` operator in an async function that returns `U256`
92 | |         info!("price {}", price.to_string());
93 | |         Ok(price)
94 | |     }
   | |_____- this function should return `Result` or `Option` to accept `?`
   |
   = help: the trait `FromResidual<std::result::Result<Infallible, error::Error>>` is not implemented for `U256`

Some errors have detailed explanations: E0277, E0308.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `web3` (lib) due to 2 previous errors

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions