如何为指定Target配置Cargo不稳定选项?
针对指定Target配置build-std的正确方式
你可以通过在[unstable.target.<目标三元组>]下声明build-std来实现仅对特定Target启用该配置,全局保留unstable-options = true以开启不稳定选项支持。
正确的.cargo/config.toml配置如下:
[unstable] unstable-options = true [unstable.target.thumbv7em-none-eabihf] build-std = ["core", "alloc"]
这样配置后,只有编译thumbv7em-none-eabihf这个Target时,Cargo才会使用指定的build-std参数;编译默认主机Target或其他未指定的Target时,不会应用该配置。
内容的提问来源于stack exchange,提问作者Alex Koz.
相关产品推荐
相关产品推荐

