gpt4 book ai didi

rust - Cargo 是否支持自定义配置文件?

转载 作者:行者123 更新时间:2023-11-29 08:08:41 25 4
gpt4 key购买 nike

我经常想在 Release模式下使用 debug = true 进行编译,这样我就可以更轻松地阅读生成的程序集。我目前正在这样做:

[profile.release]
debug = true

但我不希望在我的最终发布版本中有任何调试符号。我想做类似的事情:

[profile.custom]
debug = true
opt-level = 3
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'unwind'

然后运行

cargo build --custom

我读过 the documentation无济于事。

最佳答案

截至Rust v1.57.0 , custom profiles feature现在稳定了。

添加配置文件部分,指定要继承的基本配置文件,并根据需要进行调整:

[profile.production]
inherits = "release"
lto = true

通过 --profile <name> 指定要使用的配置文件标记 cargo 。

关于rust - Cargo 是否支持自定义配置文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41920192/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com