工作区成员的特定配置文件

Specific profiles for workspace members

是否可以为工作区的成员指定特定的配置文件? 如果我将个人资料写入会员 Cargo.toml,我会得到:

warning: profiles for the non root package will be ignored, specify profiles at the workspace root:

我还尝试将特定配置文件放入工作区根目录 Cargo.toml:

[profile.release]
opt-level = 3

[profile.release.hal]
# optimizer kills assembly code
opt-level = 1

但是,它似乎也被忽略了,因为详细输出中的应用选项显示:

Running `rustc --crate-name hal src/hal/lib.rs --crate-type lib -C opt-level=3 --emit=dep-info,link [...]

除了完全避免工作空间之外,还有其他方法吗?

自 Rust 1.43 以来,这现在得到支持和稳定:

[profile.release]
opt-level = 3

[profile.release.package.hal]
# optimizer kills assembly code
opt-level = 1

参见:https://doc.rust-lang.org/cargo/reference/profiles.html#overrides