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

Adjust -Zcheck-cfg for new rustc syntax and behavior #12845

Merged
merged 2 commits into from
Oct 18, 2023

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Oct 18, 2023

rust-lang/rust#111072 introduced a new syntax for rustc --check-cfg argument. This PR adjust cargo -Zcheck-cfg for new that new syntax and behavior.

This PR removes all the -Zcheck-cfg options (features, names, values, output), as they don't make much sense now since with the new rustc behavior: features, names and values are all combine together and the output option was only here because the other were.

Now the new behavior from cargo is to always pass one --check-cfg argument to rustc for the features which implicitly enables well known names and values.

@rustbot
Copy link
Collaborator

rustbot commented Oct 18, 2023

r? @weihanglo

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added A-build-execution Area: anything dealing with executing the compiler A-build-scripts Area: build.rs scripts A-unstable Area: nightly unstable support S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 18, 2023
This commit removes all the -Zcheck-cfg options (features, names,
values, output), as they don't make much sense now since features, names
and values are all combine together for upstream rustc and the output
option was only here because the other were.

Now the new behavior from cargo is to always pass one `--check-cfg`
argument to rustc for the `feature`s which implicitly enables well known
names and values.
@epage
Copy link
Contributor

epage commented Oct 18, 2023

FYI I have https://internals.rust-lang.org/t/pre-rfc-mutually-excusive-global-features/19618 as a way for users to define cfgs that can be checked. It has some implications for --check-cfgs design. Input on that Pre-RFC would be appreciated.

@rustbot rustbot added the A-documenting-cargo-itself Area: Cargo's documentation label Oct 18, 2023
@epage
Copy link
Contributor

epage commented Oct 18, 2023

@bors r+

@bors
Copy link
Collaborator

bors commented Oct 18, 2023

📌 Commit 2f79f15 has been approved by epage

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 Oct 18, 2023
@Urgau
Copy link
Member Author

Urgau commented Oct 18, 2023

FYI I have https://internals.rust-lang.org/t/pre-rfc-mutually-excusive-global-features/19618 as a way for users to define cfgs that can be checked. It has some implications for --check-cfgs design. Input on that Pre-RFC would be appreciated.

I've just read it a second time, and I don't see any potential problems for --check-cfg or --cfg.
The introduction of namespaces shouldn't be a problem for either of them.

@bors
Copy link
Collaborator

bors commented Oct 18, 2023

⌛ Testing commit 2f79f15 with merge 16629e6...

@bors
Copy link
Collaborator

bors commented Oct 18, 2023

☀️ Test successful - checks-actions
Approved by: epage
Pushing 16629e6 to master...

@bors bors merged commit 16629e6 into rust-lang:master Oct 18, 2023
20 checks passed
@Urgau Urgau deleted the check-cfg-adjust-for-rustc branch October 18, 2023 17:28
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 20, 2023
Update cargo

22 commits in 8eb8acbb116e7923ea2ce33a50109933ed5ab375..d2f6a048529eb8e9ebc55d793abd63456c98fac2
2023-10-17 11:55:04 +0000 to 2023-10-20 18:25:30 +0000
- chore(deps): bump rustix from 0.38.18 to 0.38.19 (rust-lang/cargo#12851)
- refactor: centralize logic of getting max resolve version (rust-lang/cargo#12860)
- If there's a version in the lock file only use that exact version (rust-lang/cargo#12772)
- Make the precise field of a source an Enum (rust-lang/cargo#12849)
- fix(cli): Provide next steps for bad -Z flag (rust-lang/cargo#12857)
- fix(remove): Preserve feature comments (rust-lang/cargo#12837)
- docs: fix typo (rust-lang/cargo#12844)
- chore(triagebot): auto label when PR review state changes (rust-lang/cargo#12856)
- fix(add): Preserve more comments (rust-lang/cargo#12838)
- ci: big ⚠️ to ensure the CNAME file is always there (rust-lang/cargo#12853)
- docs(cargo-bench): `--bench` is passed in unconditionally to bench harnesses (rust-lang/cargo#12850)
- docs(contrib): generate redirection HTML pages in CI (rust-lang/cargo#12846)
- docs: remove review capacity notice (rust-lang/cargo#12842)
- fix(help):Clarify install's positional (rust-lang/cargo#12841)
- Adjust `-Zcheck-cfg` for new rustc syntax and behavior (rust-lang/cargo#12845)
- fix(replace): Partial-version spec support (rust-lang/cargo#12806)
- Print environment variables for build script executions with `-vv` (rust-lang/cargo#12829)
- fix(cli): Suggest cargo-search on bad commands (rust-lang/cargo#12840)
- docs(contrib): Policy on manifest editing (rust-lang/cargo#12836)
- ci/contrib: use separate concurrency group (rust-lang/cargo#12835)
- ci/contrib: do not fail on missing gh-pages (rust-lang/cargo#12834)
- Clarify flag behavior in `cargo remove --help` (rust-lang/cargo#12823)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 21, 2023
Update cargo

22 commits in 8eb8acbb116e7923ea2ce33a50109933ed5ab375..d2f6a048529eb8e9ebc55d793abd63456c98fac2
2023-10-17 11:55:04 +0000 to 2023-10-20 18:25:30 +0000
- chore(deps): bump rustix from 0.38.18 to 0.38.19 (rust-lang/cargo#12851)
- refactor: centralize logic of getting max resolve version (rust-lang/cargo#12860)
- If there's a version in the lock file only use that exact version (rust-lang/cargo#12772)
- Make the precise field of a source an Enum (rust-lang/cargo#12849)
- fix(cli): Provide next steps for bad -Z flag (rust-lang/cargo#12857)
- fix(remove): Preserve feature comments (rust-lang/cargo#12837)
- docs: fix typo (rust-lang/cargo#12844)
- chore(triagebot): auto label when PR review state changes (rust-lang/cargo#12856)
- fix(add): Preserve more comments (rust-lang/cargo#12838)
- ci: big ⚠️ to ensure the CNAME file is always there (rust-lang/cargo#12853)
- docs(cargo-bench): `--bench` is passed in unconditionally to bench harnesses (rust-lang/cargo#12850)
- docs(contrib): generate redirection HTML pages in CI (rust-lang/cargo#12846)
- docs: remove review capacity notice (rust-lang/cargo#12842)
- fix(help):Clarify install's positional (rust-lang/cargo#12841)
- Adjust `-Zcheck-cfg` for new rustc syntax and behavior (rust-lang/cargo#12845)
- fix(replace): Partial-version spec support (rust-lang/cargo#12806)
- Print environment variables for build script executions with `-vv` (rust-lang/cargo#12829)
- fix(cli): Suggest cargo-search on bad commands (rust-lang/cargo#12840)
- docs(contrib): Policy on manifest editing (rust-lang/cargo#12836)
- ci/contrib: use separate concurrency group (rust-lang/cargo#12835)
- ci/contrib: do not fail on missing gh-pages (rust-lang/cargo#12834)
- Clarify flag behavior in `cargo remove --help` (rust-lang/cargo#12823)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 22, 2023
Update cargo

22 commits in 8eb8acbb116e7923ea2ce33a50109933ed5ab375..d2f6a048529eb8e9ebc55d793abd63456c98fac2
2023-10-17 11:55:04 +0000 to 2023-10-20 18:25:30 +0000
- chore(deps): bump rustix from 0.38.18 to 0.38.19 (rust-lang/cargo#12851)
- refactor: centralize logic of getting max resolve version (rust-lang/cargo#12860)
- If there's a version in the lock file only use that exact version (rust-lang/cargo#12772)
- Make the precise field of a source an Enum (rust-lang/cargo#12849)
- fix(cli): Provide next steps for bad -Z flag (rust-lang/cargo#12857)
- fix(remove): Preserve feature comments (rust-lang/cargo#12837)
- docs: fix typo (rust-lang/cargo#12844)
- chore(triagebot): auto label when PR review state changes (rust-lang/cargo#12856)
- fix(add): Preserve more comments (rust-lang/cargo#12838)
- ci: big ⚠️ to ensure the CNAME file is always there (rust-lang/cargo#12853)
- docs(cargo-bench): `--bench` is passed in unconditionally to bench harnesses (rust-lang/cargo#12850)
- docs(contrib): generate redirection HTML pages in CI (rust-lang/cargo#12846)
- docs: remove review capacity notice (rust-lang/cargo#12842)
- fix(help):Clarify install's positional (rust-lang/cargo#12841)
- Adjust `-Zcheck-cfg` for new rustc syntax and behavior (rust-lang/cargo#12845)
- fix(replace): Partial-version spec support (rust-lang/cargo#12806)
- Print environment variables for build script executions with `-vv` (rust-lang/cargo#12829)
- fix(cli): Suggest cargo-search on bad commands (rust-lang/cargo#12840)
- docs(contrib): Policy on manifest editing (rust-lang/cargo#12836)
- ci/contrib: use separate concurrency group (rust-lang/cargo#12835)
- ci/contrib: do not fail on missing gh-pages (rust-lang/cargo#12834)
- Clarify flag behavior in `cargo remove --help` (rust-lang/cargo#12823)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 22, 2023
Update cargo

22 commits in 8eb8acbb116e7923ea2ce33a50109933ed5ab375..d2f6a048529eb8e9ebc55d793abd63456c98fac2
2023-10-17 11:55:04 +0000 to 2023-10-20 18:25:30 +0000
- chore(deps): bump rustix from 0.38.18 to 0.38.19 (rust-lang/cargo#12851)
- refactor: centralize logic of getting max resolve version (rust-lang/cargo#12860)
- If there's a version in the lock file only use that exact version (rust-lang/cargo#12772)
- Make the precise field of a source an Enum (rust-lang/cargo#12849)
- fix(cli): Provide next steps for bad -Z flag (rust-lang/cargo#12857)
- fix(remove): Preserve feature comments (rust-lang/cargo#12837)
- docs: fix typo (rust-lang/cargo#12844)
- chore(triagebot): auto label when PR review state changes (rust-lang/cargo#12856)
- fix(add): Preserve more comments (rust-lang/cargo#12838)
- ci: big ⚠️ to ensure the CNAME file is always there (rust-lang/cargo#12853)
- docs(cargo-bench): `--bench` is passed in unconditionally to bench harnesses (rust-lang/cargo#12850)
- docs(contrib): generate redirection HTML pages in CI (rust-lang/cargo#12846)
- docs: remove review capacity notice (rust-lang/cargo#12842)
- fix(help):Clarify install's positional (rust-lang/cargo#12841)
- Adjust `-Zcheck-cfg` for new rustc syntax and behavior (rust-lang/cargo#12845)
- fix(replace): Partial-version spec support (rust-lang/cargo#12806)
- Print environment variables for build script executions with `-vv` (rust-lang/cargo#12829)
- fix(cli): Suggest cargo-search on bad commands (rust-lang/cargo#12840)
- docs(contrib): Policy on manifest editing (rust-lang/cargo#12836)
- ci/contrib: use separate concurrency group (rust-lang/cargo#12835)
- ci/contrib: do not fail on missing gh-pages (rust-lang/cargo#12834)
- Clarify flag behavior in `cargo remove --help` (rust-lang/cargo#12823)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 22, 2023
Update cargo

22 commits in 8eb8acbb116e7923ea2ce33a50109933ed5ab375..d2f6a048529eb8e9ebc55d793abd63456c98fac2
2023-10-17 11:55:04 +0000 to 2023-10-20 18:25:30 +0000
- chore(deps): bump rustix from 0.38.18 to 0.38.19 (rust-lang/cargo#12851)
- refactor: centralize logic of getting max resolve version (rust-lang/cargo#12860)
- If there's a version in the lock file only use that exact version (rust-lang/cargo#12772)
- Make the precise field of a source an Enum (rust-lang/cargo#12849)
- fix(cli): Provide next steps for bad -Z flag (rust-lang/cargo#12857)
- fix(remove): Preserve feature comments (rust-lang/cargo#12837)
- docs: fix typo (rust-lang/cargo#12844)
- chore(triagebot): auto label when PR review state changes (rust-lang/cargo#12856)
- fix(add): Preserve more comments (rust-lang/cargo#12838)
- ci: big ⚠️ to ensure the CNAME file is always there (rust-lang/cargo#12853)
- docs(cargo-bench): `--bench` is passed in unconditionally to bench harnesses (rust-lang/cargo#12850)
- docs(contrib): generate redirection HTML pages in CI (rust-lang/cargo#12846)
- docs: remove review capacity notice (rust-lang/cargo#12842)
- fix(help):Clarify install's positional (rust-lang/cargo#12841)
- Adjust `-Zcheck-cfg` for new rustc syntax and behavior (rust-lang/cargo#12845)
- fix(replace): Partial-version spec support (rust-lang/cargo#12806)
- Print environment variables for build script executions with `-vv` (rust-lang/cargo#12829)
- fix(cli): Suggest cargo-search on bad commands (rust-lang/cargo#12840)
- docs(contrib): Policy on manifest editing (rust-lang/cargo#12836)
- ci/contrib: use separate concurrency group (rust-lang/cargo#12835)
- ci/contrib: do not fail on missing gh-pages (rust-lang/cargo#12834)
- Clarify flag behavior in `cargo remove --help` (rust-lang/cargo#12823)

r? ghost
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Oct 23, 2023
Update cargo

22 commits in 8eb8acbb116e7923ea2ce33a50109933ed5ab375..d2f6a048529eb8e9ebc55d793abd63456c98fac2
2023-10-17 11:55:04 +0000 to 2023-10-20 18:25:30 +0000
- chore(deps): bump rustix from 0.38.18 to 0.38.19 (rust-lang/cargo#12851)
- refactor: centralize logic of getting max resolve version (rust-lang/cargo#12860)
- If there's a version in the lock file only use that exact version (rust-lang/cargo#12772)
- Make the precise field of a source an Enum (rust-lang/cargo#12849)
- fix(cli): Provide next steps for bad -Z flag (rust-lang/cargo#12857)
- fix(remove): Preserve feature comments (rust-lang/cargo#12837)
- docs: fix typo (rust-lang/cargo#12844)
- chore(triagebot): auto label when PR review state changes (rust-lang/cargo#12856)
- fix(add): Preserve more comments (rust-lang/cargo#12838)
- ci: big ⚠️ to ensure the CNAME file is always there (rust-lang/cargo#12853)
- docs(cargo-bench): `--bench` is passed in unconditionally to bench harnesses (rust-lang/cargo#12850)
- docs(contrib): generate redirection HTML pages in CI (rust-lang/cargo#12846)
- docs: remove review capacity notice (rust-lang/cargo#12842)
- fix(help):Clarify install's positional (rust-lang/cargo#12841)
- Adjust `-Zcheck-cfg` for new rustc syntax and behavior (rust-lang/cargo#12845)
- fix(replace): Partial-version spec support (rust-lang/cargo#12806)
- Print environment variables for build script executions with `-vv` (rust-lang/cargo#12829)
- fix(cli): Suggest cargo-search on bad commands (rust-lang/cargo#12840)
- docs(contrib): Policy on manifest editing (rust-lang/cargo#12836)
- ci/contrib: use separate concurrency group (rust-lang/cargo#12835)
- ci/contrib: do not fail on missing gh-pages (rust-lang/cargo#12834)
- Clarify flag behavior in `cargo remove --help` (rust-lang/cargo#12823)

r? ghost
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 23, 2023
…k-cfg, r=<try>

Prepare the `bootstrap` tool for the new check-cfg syntax

This PR prepare the `bootstrap` tool for the [new check-cfg syntax](rust-lang#111072) as well as the according [changes to Cargo](rust-lang/cargo#12845).

Note that while the new syntax can technically available on stage > 2, we actually cannot use it since we need a cargo version that supports the new syntax which won't happen until the next beta bump (if I understand everything correctly).

r? bootstrap
bors added a commit to rust-lang-ci/rust that referenced this pull request Oct 26, 2023
…k-cfg, r=Kobzol

Prepare the `bootstrap` tool for the new check-cfg syntax

This PR prepare the `bootstrap` tool for the [new check-cfg syntax](rust-lang#111072) as well as the according [changes to Cargo](rust-lang/cargo#12845).

~~Note that while the new syntax can technically available on stage > 2, we actually cannot use it since we need a cargo version that supports the new syntax which won't happen until the next beta bump (if I understand everything correctly).~~

r? bootstrap
Urgau added a commit to Urgau/libc that referenced this pull request Oct 27, 2023
bors added a commit that referenced this pull request Oct 27, 2023
Remove outdated option to `-Zcheck-cfg` warnings

Forgot to remove those in #12845.

Note: Would it make sense to have feature-gate tests for those? and if so what would be the recommended way?
illicitonion added a commit to illicitonion/num_enum that referenced this pull request Oct 27, 2023
Reflects the updates in Cargo nightly: rust-lang/cargo#12845
illicitonion added a commit to illicitonion/num_enum that referenced this pull request Oct 27, 2023
Reflects the updates in Cargo nightly: rust-lang/cargo#12845
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Oct 28, 2023
…Kobzol

Prepare the `bootstrap` tool for the new check-cfg syntax

This PR prepare the `bootstrap` tool for the [new check-cfg syntax](rust-lang/rust#111072) as well as the according [changes to Cargo](rust-lang/cargo#12845).

~~Note that while the new syntax can technically available on stage > 2, we actually cannot use it since we need a cargo version that supports the new syntax which won't happen until the next beta bump (if I understand everything correctly).~~

r? bootstrap
@ehuss ehuss added this to the 1.75.0 milestone Nov 6, 2023
snogge pushed a commit to snogge/rust-lang-libc that referenced this pull request Jan 15, 2024
snogge pushed a commit to snogge/rust-lang-libc that referenced this pull request Jan 15, 2024
snogge pushed a commit to snogge/rust-lang-libc that referenced this pull request Jan 15, 2024
snogge pushed a commit to snogge/rust-lang-libc that referenced this pull request Jan 26, 2024
lnicola pushed a commit to lnicola/rust-analyzer that referenced this pull request Apr 7, 2024
…Kobzol

Prepare the `bootstrap` tool for the new check-cfg syntax

This PR prepare the `bootstrap` tool for the [new check-cfg syntax](rust-lang/rust#111072) as well as the according [changes to Cargo](rust-lang/cargo#12845).

~~Note that while the new syntax can technically available on stage > 2, we actually cannot use it since we need a cargo version that supports the new syntax which won't happen until the next beta bump (if I understand everything correctly).~~

r? bootstrap
RalfJung pushed a commit to RalfJung/rust-analyzer that referenced this pull request Apr 27, 2024
…Kobzol

Prepare the `bootstrap` tool for the new check-cfg syntax

This PR prepare the `bootstrap` tool for the [new check-cfg syntax](rust-lang/rust#111072) as well as the according [changes to Cargo](rust-lang/cargo#12845).

~~Note that while the new syntax can technically available on stage > 2, we actually cannot use it since we need a cargo version that supports the new syntax which won't happen until the next beta bump (if I understand everything correctly).~~

r? bootstrap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-build-execution Area: anything dealing with executing the compiler A-build-scripts Area: build.rs scripts A-documenting-cargo-itself Area: Cargo's documentation A-unstable Area: nightly unstable support S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants