我想通过Cargo运行一个示例,但我遇到了一个错误:

error: failed to parse manifest at `/Users/aviralsrivastava/dev/subxt/Cargo.toml`

完整的堆栈跟踪是:

error: failed to parse manifest at `/Users/aviralsrivastava/dev/subxt/Cargo.toml`

Caused by:
  feature `edition2021` is required

  The package requires the Cargo feature called `edition2021`, but that feature is not stabilized in this version of Cargo (1.56.0-nightly (b51439fd8 2021-08-09)).
  Consider adding `cargo-features = ["edition2021"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature.
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2021 for more information about the status of this feature.

根据建议,我继续修改Cargo .汤姆:

  Consider adding `cargo-features = ["edition2021"]` to the top of Cargo.toml (above the [package] table) to tell Cargo you are opting in to use this unstable feature.
diff --git a/Cargo.toml b/Cargo.toml
index 26a02c7..186d09b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
 [workspace]
 members = [".", "cli", "codegen", "macro"]
-
+cargo-features = ["edition2021"]
 [package]
 name = "subxt"
 version = "0.15.0"
(END)

我仍然面临着相同的错误,就好像toml文件中没有任何更改一样.

如何解决上述错误以使用不稳定的软件包?

推荐答案

更新 rust 迹以满足新版本2021的要求.

rustup default nightly && rustup update

多亏了@ken.

But I love 100 personally.

Rust相关问答推荐

基于对vec值的引用从该值中删除该值

Rust kill std::processs::child

为什么Rust函数的移植速度比C++慢2倍?

如何为 struct 字段设置新值并在Ruust中的可变方法中返回旧值

带参考文献的 rust 元组解构

如何在函数中返回自定义字符串引用?

在生存期内将非静态可变引用转换为范围内的静态可变引用

为什么`str`类型可以是任意大小(未知大小),而`string`类型的大小应该是已知的?

有没有一种方法可以创建一个闭包来计算Rust中具有随机系数的n次多项式?

如何对一个特征的两个实现进行单元测试?

通过mem::transmute将数组展平安全吗?

为什么需要同时为值和引用实现`From`?方法不应该自动解引用或borrow 吗?(2023-06-16)

Rust中如何实现一个与Sized相反的负特性(Unsized)

在多核嵌入式 Rust 中,我可以使用静态 mut 进行单向数据共享吗?

如何限制通用 const 参数中允许的值?

在 Rust 中,将可变引用传递给函数的机制是什么?

Rust,我如何正确释放堆分配的内存?

有没有办法阻止 rust-analyzer 使非活动代码变暗?

火箭整流罩、tokio-scheduler 和 cron 的生命周期问题

Rust:为什么在 struct 中borrow 引用会borrow 整个 struct?