为什么在稳定版本中无论如何都不能工作?

Gen*_*ely 9 rust anyhow

我有一个干净的项目,无论如何我都将 1.0.66 包含在其中。安装了最新版本的 Rust。我收到一条错误消息,说无论如何都需要夜间版本。也许这是由于使用了 backtrace,但 Rust 版本 1.65 中支持它。我不明白如何解决这个问题。

Cargo.toml

[package]
name = "libfs"
version = "0.1.0"
edition = "2021"
[dependencies]
tokio = {version = "1.22", features = ["full"]}
anyhow = {version = "1.0.66", features = ["default"]}
Run Code Online (Sandbox Code Playgroud)

src/lib.rs

#[tokio::test]
async fn run_test() {
    println!("test");
}

Run Code Online (Sandbox Code Playgroud)

输出

$ cargo build
   Compiling anyhow v1.0.66
error[E0554]: `#![feature]` may not be used on the stable release channel
   --> /home/dima/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.66/src/lib.rs:214:32
    |
214 | #![cfg_attr(backtrace, feature(error_generic_member_access, provide_any))]
    |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^

error[E0554]: `#![feature]` may not be used on the stable release channel
   --> /home/dima/.cargo/registry/src/github.com-1ecc6299db9ec823/anyhow-1.0.66/src/lib.rs:214:61
    |
214 | #![cfg_attr(backtrace, feature(error_generic_member_access, provide_any))]
    |                                                             ^^^^^^^^^^^

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

Run Code Online (Sandbox Code Playgroud)