Rust build error: unknown `--json` option `future-incompat`

Rust build error: unknown `--json` option `future-incompat`

我正在尝试使用 Rust 为 Adafruit CLUE 构建一个基本应用程序。

使用外设访问 crate (PAC) 时一切正常,但我想使用 Nordic Semiconductors 的 HAL crate。

我建立了一个非常基本的项目,它使用了他们的 nrf52840-hal crate. When running cargo build, I get the following error (full build log with --verbose):

    Updating crates.io index
   Compiling semver-parser v0.7.0
   Compiling cortex-m v0.7.4
   Compiling proc-macro2 v1.0.37
   Compiling nb v1.0.0
   Compiling unicode-xid v0.2.3
   Compiling syn v1.0.92
   Compiling vcell v0.1.3
   Compiling void v1.0.2
   Compiling bitfield v0.13.2
   Compiling cortex-m-rt v0.7.1
   Compiling critical-section v0.2.7
   Compiling typenum v1.15.0
info: syncing channel updates for 'nightly-2021-08-18-x86_64-unknown-linux-gnu'
   Compiling az v1.2.0
   Compiling nrf52840-pac v0.11.0
info: latest update on 2021-08-18, rust version 1.56.0-nightly (30a0a9b69 2021-08-17)
   Compiling fixed v1.15.0
   Compiling cfg-if v1.0.0
info: component 'rust-src' is up to date
info: component 'rust-std' for target 'riscv32imac-unknown-none-elf' is up to date
info: component 'rust-std' for target 'riscv32imc-unknown-none-elf' is up to date
info: component 'rust-std' for target 'thumbv6m-none-eabi' is up to date
info: component 'rust-std' for target 'thumbv7em-none-eabi' is up to date
info: component 'rustfmt' for target 'x86_64-unknown-linux-gnu' is up to date
warning: Force-skipping unavailable component 'rust-std-avr-specs/avr-atmpeg328p.json'
   Compiling bare-metal v1.0.0
error: unknown `--json` option `future-incompat`

   Compiling half v1.8.2
error: could not compile `critical-section`
warning: build failed, waiting for other jobs to finish...
error: build failed

我在 Ubuntu 20.04 上使用带有稳定工具链的 rustup(几乎使用 2022-05-03 不会改变错误消息的任何内容)。 Rustup 版本输出为:

rustup 1.24.3 (ce5817a94 2021-05-31)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.60.0 (7737e0b5c 2022-04-04)`

完整项目可用 here

我的 .cargo/config.toml 文件是:

[build]
target = "thumbv7em-none-eabihf"
rustflags = [
  "-C", "link-arg=-Tlink.x",
]

Cargo.toml是:

[package]
name = "hal-test"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
cortex-m-rt = "0.7.1"
nrf52840-hal = "0.15.0"
panic-halt = "0.2.0"

并且 src/main.rs 文件是:

#![no_std]
#![no_main]

use panic_halt as _;

#[cortex_m_rt::entry]
fn main() -> ! {
    loop {}
}

我试图遍历依赖关系树,但我没能找到这个 future-incompat 选项的添加位置,因为它被多次传递给 rustc 并且它成功了。

我将不胜感激关于在哪里可以进一步查看的任何指示。

2022-05-06 更新:在 Ubuntu 21.04 上使用完全相同的工具链版本构建项目,我将不得不进一步调查。

问题已通过从 rustup snap 切换并使用 运行 shell 脚本 (https://www.rust-lang.org/tools/install) 的推荐安装方法得到解决。