Is it possible to specify specific profiles for members of a workspace?
If I write a profile into the member Cargo.toml
I get:
warning: profiles for the non root package will be ignored, specify profiles at the workspace root:
I also tried to put a specific profile into workspace root's Cargo.toml
:
[profile.release]
opt-level = 3
[profile.release.hal]
# optimizer kills assembly code
opt-level = 1
However, it seems to be ignored too, as the applied options in the the verbose output show:
Running `rustc --crate-name hal src/hal/lib.rs --crate-type lib -C opt-level=3 --emit=dep-info,link [...]
Is there any other way beside avoiding workspaces at all?
From your desktop, click your profile picture in the top right. Click Profile. Click Edit. Edit your profile, then click Save Changes.
A workspace is a set of packages that share the same Cargo.lock and output directory. Let's make a project using a workspace—we'll use trivial code so we can concentrate on the structure of the workspace. There are multiple ways to structure a workspace, so we'll just show one common way.
This is now supported and stabilized since Rust 1.43:
[profile.release]
opt-level = 3
[profile.release.package.hal]
# optimizer kills assembly code
opt-level = 1
See: https://doc.rust-lang.org/cargo/reference/profiles.html#overrides
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With