rust-lang / rust-lang/cargo

Per-target profiles?

Open
#4,897 24 comments 77 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-profiles C-feature-request S-needs-info
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

https://github.com/rust-lang/cargo/pull/4817

This commit enables incremental compilation by default […] A profile.dev.incremental field is added to Cargo.toml to disable it on a per-project basis (in case of bugs).

I was hoping to use something like this:

[target.'cfg(windows)'.profile.dev]
incremental = false

to work around https://github.com/rust-lang/rust/issues/47186, but looking at src/cargo/util/toml/mod.rs it seems that target.cfg sections can only be combined with dependencies, not other sections like profile.

Would it make sense to add support for this?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading src/cargo/util/toml/mod.rs, focusing on how target.cfg sections are currently combined with dependencies and how profile.dev.incremental is parsed. Determine whether the requested target-specific profile syntax can be supported, then verify that the setting works for the Windows target while preserving existing profile behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.