【发布时间】:2019-10-21 11:50:25
【问题描述】:
我收到了这个错误:
error: failed to parse manifest at `...\Cargo.toml`
Caused by:
Feature `client` depends on `rusttls` which is not an optional dependency.
Consider adding `optional = true` to the dependency
如果我添加 optional = true,它就会消失,但出于安全原因,我不希望 rusttls 是可选的。
除了将其设置为可选之外,此错误的确切原因和可能的解决方案是什么?
我的 Cargo.toml 有这个:
[features]
default = ["client", "server"]
client = ["serde_json", "serde-xml-rs", "serde_ignored", "hyper", "hyper-tls", "rusttls", "tokio-core", "url", "uuid", "multipart"]
server = ["serde_json", "serde-xml-rs", "serde_ignored", "hyper", "hyper-tls", "rusttls", "tokio-core", "tokio-proto", "tokio-tls", "regex", "percent-encoding", "url", "uuid", "multipart"]
根据我在 Rust 书中读到的内容,这样做应该意味着默认情况下客户端和服务器具有这些依赖关系,对吧?
【问题讨论】:
-
只要重读doc.rust-lang.org/cargo/reference/…,我就会明白问题所在。因为我使用了一个工具来自动生成它,所以我不知道为什么会失败,功能仅用于可选编译所以是的@Shepmaster,没有必要在 [features] 下添加强制板条箱。很抱歉,我很确定问题与[功能]有关,这就是为什么我只发布了这个。
标签: rust rust-cargo