Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support rustflags per profile #10217

Merged
merged 1 commit into from
Jan 10, 2022

Conversation

zhamlin
Copy link
Contributor

@zhamlin zhamlin commented Dec 19, 2021

Fix for issue #7878

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

Please see the contribution instructions for more information.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 19, 2021
@zhamlin zhamlin marked this pull request as ready for review December 19, 2021 05:02
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR for this! I think there's also some documentation in src/doc which may need updating as well.

Given that this is somewhat of a major feature as well I think I would personally prefer to err on the side of placing this behind a feature gate to start with. Others on the team may feel differently though!

src/cargo/core/profiles.rs Outdated Show resolved Hide resolved
@ehuss
Copy link
Contributor

ehuss commented Dec 20, 2021

I think it would be good to also talk about how this works with rustdocflags. If there are flags that are required for correctness, then cargo test --doc would fail. I'm not suggesting that this should add rustdocflags, though. Just to consider what the impact will be.

I'm a little nervous adding this, as it is a very low-level thing which we haven't exposed in Cargo.toml before. One of my biggest concerns is that it can cause backward-compatibility hazards. For example, when Cargo adds new features or changes the way it invokes rustc, that can interfere with pre-existing flags. In a sense, this seems to be an end-run around Cargo not exposing the workflows that users want.

I'm not concerned enough to block it, as I can see its utility. However, I think we should tread very carefully.

@alexcrichton
Copy link
Member

I share many of @ehuss's concerns as well, which is primarily why I'd like to see this feature-gated to start off with.

@joshtriplett
Copy link
Member

I agree that this needs a feature-gate initially.

@zhamlin zhamlin force-pushed the feat/profile-rustflags branch 5 times, most recently from 5f4febf to da525b4 Compare December 29, 2021 04:26
Copy link
Member

@alexcrichton alexcrichton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a test that this is unstable?

Additionally I think that support also needs to be added for CARGO_PROFILE_RELEASE_RUSTFLAGS=... by configuring profiles via env vars.

src/doc/src/reference/unstable.md Outdated Show resolved Hide resolved
tests/testsuite/profile_config.rs Outdated Show resolved Hide resolved
@bors
Copy link
Collaborator

bors commented Jan 4, 2022

☔ The latest upstream changes (presumably #10088) made this pull request unmergeable. Please resolve the merge conflicts.

@zhamlin zhamlin force-pushed the feat/profile-rustflags branch 2 times, most recently from 7708da6 to 501f710 Compare January 5, 2022 02:46
@zhamlin
Copy link
Contributor Author

zhamlin commented Jan 5, 2022

Thanks for the review.

Fixed the issues you mentioned and added a test to verify passing rustflags via CARGO_PROFILE_RELEASE_RUSTFLAGS, it appears to be working without any additional code changes.

@alexcrichton alexcrichton added the T-cargo Team: Cargo label Jan 5, 2022
@alexcrichton
Copy link
Member

Looks good to me, thanks! I'd like to double-check though that others are ok merging this as well (note that this implementation is gated behind a cargo feature)

@rfcbot fcp merge

@rfcbot
Copy link
Collaborator

rfcbot commented Jan 5, 2022

Team member @alexcrichton has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period An FCP proposal has started, but not yet signed off. disposition-merge FCP with intent to merge labels Jan 5, 2022
src/cargo/core/profiles.rs Show resolved Hide resolved
src/doc/src/reference/unstable.md Outdated Show resolved Hide resolved
@ehuss
Copy link
Contributor

ehuss commented Jan 7, 2022

I was a little concerned about the large number of new clone() calls, but in some rough benchmarking it doesn't seem to have much of an impact.

@rfcbot rfcbot removed the proposed-final-comment-period An FCP proposal has started, but not yet signed off. label Jan 8, 2022
@rfcbot
Copy link
Collaborator

rfcbot commented Jan 8, 2022

🔔 This is now entering its final comment period, as per the review above. 🔔

@ehuss
Copy link
Contributor

ehuss commented Jan 10, 2022

Thanks!

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 10, 2022

📌 Commit 68fd673 has been approved by ehuss

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 10, 2022
@bors
Copy link
Collaborator

bors commented Jan 10, 2022

⌛ Testing commit 68fd673 with merge 0655dd2...

@bors
Copy link
Collaborator

bors commented Jan 10, 2022

☀️ Test successful - checks-actions
Approved by: ehuss
Pushing 0655dd2 to master...

@bors bors merged commit 0655dd2 into rust-lang:master Jan 10, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 12, 2022
Update cargo

6 commits in 358e79fe56fe374649275ca7aebaafd57ade0e8d..06b9d31743210b788b130c8a484c2838afa6fc27
2022-01-04 18:39:45 +0000 to 2022-01-11 23:47:29 +0000
- Port cargo to clap3 (rust-lang/cargo#10265)
- feat: support rustflags per profile (rust-lang/cargo#10217)
- Make bors ignore the PR template so it doesn't end up in merge messages (rust-lang/cargo#10267)
- Be resilient to most IO error and filesystem loop while walking dirs (rust-lang/cargo#10214)
- Remove the option to disable pipelining (rust-lang/cargo#10258)
- Always ask rustc for messages about artifacts, and always process them (rust-lang/cargo#10255)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 13, 2022
Update cargo

6 commits in 358e79fe56fe374649275ca7aebaafd57ade0e8d..06b9d31743210b788b130c8a484c2838afa6fc27
2022-01-04 18:39:45 +0000 to 2022-01-11 23:47:29 +0000
- Port cargo to clap3 (rust-lang/cargo#10265)
- feat: support rustflags per profile (rust-lang/cargo#10217)
- Make bors ignore the PR template so it doesn't end up in merge messages (rust-lang/cargo#10267)
- Be resilient to most IO error and filesystem loop while walking dirs (rust-lang/cargo#10214)
- Remove the option to disable pipelining (rust-lang/cargo#10258)
- Always ask rustc for messages about artifacts, and always process them (rust-lang/cargo#10255)
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 13, 2022
Update cargo

6 commits in 358e79fe56fe374649275ca7aebaafd57ade0e8d..06b9d31743210b788b130c8a484c2838afa6fc27
2022-01-04 18:39:45 +0000 to 2022-01-11 23:47:29 +0000
- Port cargo to clap3 (rust-lang/cargo#10265)
- feat: support rustflags per profile (rust-lang/cargo#10217)
- Make bors ignore the PR template so it doesn't end up in merge messages (rust-lang/cargo#10267)
- Be resilient to most IO error and filesystem loop while walking dirs (rust-lang/cargo#10214)
- Remove the option to disable pipelining (rust-lang/cargo#10258)
- Always ask rustc for messages about artifacts, and always process them (rust-lang/cargo#10255)
@rfcbot rfcbot added finished-final-comment-period FCP complete to-announce and removed final-comment-period FCP — a period for last comments before action is taken labels Jan 18, 2022
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 19, 2022
Update cargo

16 commits in 358e79fe56fe374649275ca7aebaafd57ade0e8d..95bb3c92bf516017e812e7f1c14c2dea3845b30e
2022-01-04 18:39:45 +0000 to 2022-01-18 17:39:35 +0000
- Error when setting crate type of both dylib and cdylib in library (rust-lang/cargo#10243)
- Include `help` in `--list` (rust-lang/cargo#10300)
- Add report subcommand to bash completion. (rust-lang/cargo#10295)
- Downgrade some log messages. (rust-lang/cargo#10296)
- Enable shortcut for triage bot (rust-lang/cargo#10298)
- Bump to 0.61.0, update changelog (rust-lang/cargo#10294)
- use new cargo fmt option (rust-lang/cargo#10291)
- Add `run-fail` to semver-check for docs (rust-lang/cargo#10287)
- Use `is_symlink()` method (rust-lang/cargo#10290)
- Stabilize namespaced and weak dependency features. (rust-lang/cargo#10269)
- Port cargo to clap3 (rust-lang/cargo#10265)
- feat: support rustflags per profile (rust-lang/cargo#10217)
- Make bors ignore the PR template so it doesn't end up in merge messages (rust-lang/cargo#10267)
- Be resilient to most IO error and filesystem loop while walking dirs (rust-lang/cargo#10214)
- Remove the option to disable pipelining (rust-lang/cargo#10258)
- Always ask rustc for messages about artifacts, and always process them (rust-lang/cargo#10255)
@ehuss ehuss added this to the 1.60.0 milestone Feb 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
disposition-merge FCP with intent to merge finished-final-comment-period FCP complete S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-cargo Team: Cargo to-announce
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants