【问题标题】:'System is not running' for actix_rt 2.0.2actix_rt 2.0.2 的“系统未运行”
【发布时间】:2021-05-23 18:47:27
【问题描述】:

我尝试更新到 actix_rt 2.0.2 并收到以下错误:

线程“主”因“系统未运行”而恐慌

我的最小例子在这里

use actix_rt;
use actix_web::{HttpServer, App, HttpResponse};

async fn hello() -> HttpResponse {
    HttpResponse::Ok().finish()
}

#[actix_rt::main]
async fn main() -> std::io::Result<()> {
    let server = HttpServer::new(move || {
        App::new().route("/", actix_web::web::get().to(hello))
    });
    server.bind("127.0.0.1:8080")?.run().await
}

cargo.toml

[package]
name = "my_app"
version = "2.2.0"
authors = ["me"]
edition = "2018"

[dependencies]
actix = "0.10"
actix-web = { version = "3.3.2", default-features = false }
actix-rt = "2.0.2"

我假设这一定是 actix 板条箱之间的某些版本不兼容。是否有版本号的组合或我缺少的一些明显的东西才能让它们一起工作?

我需要 actix_rt 2.0.x 以便与 Criterion 集成

提前感谢您的任何见解。

干杯!

【问题讨论】:

    标签: compiler-errors actix-web rust-actix


    【解决方案1】:

    您的 actix crates 版本不兼容。您可以将actix-rt 降级为1,或升级到测试版,例如:

    actix = "0.11.0-beta.2"
    actix-web = "4.0.0-beta.3"
    actix-rt = "2.0.2"
    

    【讨论】:

    • 感谢它对我有用。这是我的第一个 Rust 程序,这是我的第一个错误,老实说,我发现没有有意义的错误消息提示我的方向非常令人失望。“系统没有运行”是的,感谢 Cptn Obvious!如果编译器会检查一些 repo 中的不兼容版本并准确报告该错误,那就太好了!我将继续使用 Rust,但如果这样的事情更频繁地发生,我将退出它。学习一门新语言时,良好的错误报告是必须的。
    • @Max 但是我怎么知道哪个版本相互兼容呢?
    • @Eren 我在这里查看crates.io/crates/actix-rt/2.1.0/dependencies 进行检查。我同意这是令人困惑和可以避免的,正如github.com/actix/actix-net/issues/281#issuecomment-792275955 的维护者所指出的那样
    【解决方案2】:

    #在你的 cargo.toml 文件中使用这些

        actix = "0.11.0"
        actix-web = "3.3.2"
        actix-rt = "1.1.1"
        serde = { version = "1.0.123", features = ["derive"] }
    
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-13
      • 2019-04-13
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多