bincode 上的“default-features = false”仍然需要标准库

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

我正在尝试使用 bincode crate。由于它是默认功能,它使用标准库,但我正在

no_std
环境中工作。我已将
default-features = false
添加到我的 Cargo.toml 中,但它仍然无法编译。

我的依赖:

[package]
name = "fsys"
version = "0.1.0"
edition = "2021"

[dependencies]
bincode = { version = "1.3.3", default-features = false}

这对我来说没有任何意义。

std
bincode
功能被禁用,但它仍然尝试构建与标准库的依赖关系。

这是错误消息的简短版本:

   Compiling serde v1.0.182
error[E0463]: can't find crate for `std`
  |
  = note: the `x86_64-cos` target may not support the standard library
  = note: `std` is required by `serde` because it does not declare `#![no_std]`
  = help: consider building the standard library from source with `cargo build -Zbuild-std`

最初的错误消息是这样的,但后面是 20K 行失败的

std
导入。

rust rust-cargo cargo-features
1个回答
1
投票

bincode
在版本
std
中没有
1.3.3
功能标志,如here所示。

您可能想使用 版本

2.0.0
,目前仅作为候选版本提供,但提供对
#![no_std]
的支持。

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