Matthias
Matthias

Reputation: 8180

Specific profiles for workspace members

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?

Upvotes: 18

Views: 7846

Answers (1)

Alvin Wong
Alvin Wong

Reputation: 12420

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

Upvotes: 12

Related Questions