如何解决 Anchor 上的 E0658 错误代码?

问题描述 投票:0回答:2

我想我使用

rustup
rustc
酸化安装了 rust,这两者都导致了这个错误!我该如何解决这个问题?


error[E0658]: use of unstable library feature 'bool_to_option'
  --> src/stake/tools.rs:31:18
   |
31 |                 .then_some(return_data)
   |                  ^^^^^^^^^
   |
   = note: see issue #80967 <https://github.com/rust-lang/rust/issues/80967> for more information
   = help: add `#![feature(bool_to_option)]` to the crate attributes to enable

error[E0658]: use of unstable library feature 'bool_to_option'
   --> src/vote/state/mod.rs:679:40
    |
679 |         let root = (root != Slot::MAX).then_some(root);
    |                                        ^^^^^^^^^
    |
    = note: see issue #80967 <https://github.com/rust-lang/rust/issues/80967> for more information
    = help: add `#![feature(bool_to_option)]` to the crate attributes to enable

For more information about this error, try `rustc --explain E0658`.
error: could not compile `solana-program` due to 9 previous errors

尝试从 brew 中卸载 rust 但失败了!

rust anchor solana anchor-solana
2个回答
0
投票

更新你的 Rust 版本。这是 Rust 1.62.0. 中稳定的功能


-1
投票

只需将

#![feature(bool_to_option)]
添加到文件的头部。它应该可以解决问题。

© www.soinside.com 2019 - 2024. All rights reserved.