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

Remove feature from the list of well known check-cfg name #118071

Merged
merged 3 commits into from
Nov 22, 2023

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Nov 19, 2023

This PR removes feature from the list of well known check-cfg.

This is done for multiple reasons:

  • Cargo is the source of truth, rustc shouldn't have any knowledge of it
  • It creates a conflict between Cargo and rustc when there are no features defined.
    In this case Cargo won't pass any --check-cfg for feature since no feature will ever be passed, but rustc by having in it's list adds a implicit cfg(feature, values(any())) which is completely wrong. Having any cfg feature is unexpected not allow any feature value.

While doing this, I took the opportunity to specialise the diagnostic a bit for the case above.

r? @petrochenkov

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 19, 2023
@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Nov 19, 2023
@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Nov 21, 2023

📌 Commit 3fda3ef has been approved by petrochenkov

It is now in the queue for this repository.

@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 Nov 21, 2023
@petrochenkov
Copy link
Contributor

I don't understand full implications of the Miri change though.
If it's not strictly necessary for this PR, then I'd suggest landing it separately with a review from qualified people.

@Urgau
Copy link
Member Author

Urgau commented Nov 21, 2023

I don't understand full implications of the Miri change though. If it's not strictly necessary for this PR, then I'd suggest landing it separately with a review from qualified people.

It's unfortunately required, and the reason it is, is because of Cargo not passing RUSTFLAGS to proc-macro made the bootstrap tool create the RUSTC_HOST_FLAGS which force pass some flags to our rustc shim. Inside that environment variable are some --check-cfg flags that activates checking of cfgs but the way the standard library is build by Miri makes cargo-miri not use bootstrap and so neither -Zcheck-cfg nor our extra --check-cfg are passed making the build fail on all but the bootstrap cfg.

Ignoring RUSTC_HOST_FLAGS when we detect Miri is the easiest way I found to solve the issue.

@bors
Copy link
Contributor

bors commented Nov 21, 2023

🔒 Merge conflict

This pull request and the master branch diverged in a way that cannot be automatically merged. Please rebase on top of the latest master branch, and let the reviewer approve again.

How do I rebase?

Assuming self is your fork and upstream is this repository, you can resolve the conflict following these steps:

  1. git checkout check-cfg-cargo-feature (switch to your branch)
  2. git fetch upstream master (retrieve the latest master)
  3. git rebase upstream/master -p (rebase on top of it)
  4. Follow the on-screen instruction to resolve conflicts (check git status if you got lost).
  5. git push self check-cfg-cargo-feature --force-with-lease (update this PR)

You may also read Git Rebasing to Resolve Conflicts by Drew Blessing for a short tutorial.

Please avoid the "Resolve conflicts" button on GitHub. It uses git merge instead of git rebase which makes the PR commit history more difficult to read.

Sometimes step 4 will complete without asking for resolution. This is usually due to difference between how Cargo.lock conflict is handled during merge and rebase. This is normal, and you should still perform step 5 to update this PR.

Error message
Auto-merging tests/ui/check-cfg/exhaustive-names.exhaustive_names.stderr
Auto-merging tests/ui/check-cfg/exhaustive-names.empty_names.stderr
Auto-merging tests/ui/check-cfg/exhaustive-names-values.rs
Auto-merging tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr
CONFLICT (content): Merge conflict in tests/ui/check-cfg/exhaustive-names-values.empty_names_values.stderr
Auto-merging tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
CONFLICT (content): Merge conflict in tests/ui/check-cfg/exhaustive-names-values.empty_cfg.stderr
Auto-merging compiler/rustc_session/src/config.rs
Auto-merging compiler/rustc_lint/src/context.rs
Automatic merge failed; fix conflicts and then commit the result.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 21, 2023
When building the standard library with Miri, it appears that cargo-miri
does not respect the RUSTFLAGS and even if they did it would be wrong
since they are created for ToolRustc not Std. To avoid errors ignore
RUSTC_HOST_FLAGS for Miri.
@Urgau
Copy link
Member Author

Urgau commented Nov 21, 2023

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 21, 2023
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Nov 21, 2023

📌 Commit 54c122e has been approved by petrochenkov

It is now in the queue for this repository.

@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 Nov 21, 2023
@bors
Copy link
Contributor

bors commented Nov 22, 2023

⌛ Testing commit 54c122e with merge 855c683...

@bors
Copy link
Contributor

bors commented Nov 22, 2023

☀️ Test successful - checks-actions
Approved by: petrochenkov
Pushing 855c683 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 22, 2023
@bors bors merged commit 855c683 into rust-lang:master Nov 22, 2023
12 checks passed
@rustbot rustbot added this to the 1.76.0 milestone Nov 22, 2023
@Urgau Urgau deleted the check-cfg-cargo-feature branch November 22, 2023 09:43
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (855c683): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

This benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.8% [-0.8%, -0.8%] 1
All ❌✅ (primary) - - 0

Cycles

Results

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
9.7% [2.6%, 25.6%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 676.862s -> 677.73s (0.13%)
Artifact size: 313.76 MiB -> 313.77 MiB (0.01%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants