rust-lang / rust-lang/cargo

Tracking Issue for profile-rustflags

Open
#10,271 27 comments 56 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-profiles A-rustflags C-tracking-issue S-needs-design S-waiting-on-feedback Z-profile-rustflags
Dominant language
Rust
Stars
15.5k
Forks
3k
Avg merge
23h 30m
Merged PRs (30d)
51

Description

Summary

Original issue: #7878
Implementation: #10217
Documentation: https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#profile-rustflags-option

The profile-rustflags feature allows setting RUSTFLAGS per-profile.

Status update: https://github.com/rust-lang/cargo/issues/10271#issuecomment-3258932042

For per-target-profiles, see #4897

Unresolved Issues
  • Are we ok with rustflags that can be set in Cargo.toml
  • How should things interact with rustdoc? If there is a flag that is required to correctly build a project, then cargo test may fail if they aren't passed to rustdoc. However, rustdoc doesn't accept all of rustc's flags. Adding a rustdocflags option seems to be adding more unwanted complexity, though.
  • This introduces potential backwards-compatibility hazards. For example, when Cargo adds new features or changes the way it invokes rustc, that can interfere with pre-existing flags. Is documenting this sufficient?
  • What should the behavior be with build scripts and proc-macros? Those have historically been a pain point with rustflags. Perhaps there should be a default build-override.rustflags = [].
  • Profile rustflags are not considered as part of TargetInfo, which impacts feature resolution and other things.
Future Extensions

No response

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

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 reviewing implementation issue #10217 and the unstable Cargo documentation linked in the issue. Then examine the unresolved questions about rustdoc, build scripts, proc-macros, compatibility, and TargetInfo. Done means the tracking questions have clear decisions and the profile-rustflags behavior and documentation are complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
build-system
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.