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

Make the test cfg a userspace check-cfg #131729

Merged
merged 2 commits into from
Jan 3, 2025

Conversation

Urgau
Copy link
Member

@Urgau Urgau commented Oct 15, 2024

This PR implements MCP rust-lang/compiler-team#785, which makes the test cfg a "userspace" check-cfg, i.e. no longer included in the well known cfg list.

Things to do:

@rustbot labels +S-waiting-on-MCP +F-check_cfg
r? @petrochenkov

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. 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. labels Oct 15, 2024
@rustbot
Copy link
Collaborator

rustbot commented Oct 15, 2024

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@Urgau Urgau added F-check-cfg --check-cfg S-waiting-on-MCP Status: PR has a compiler MCP and is waiting for the compiler MCP to complete. labels Oct 15, 2024
@rust-log-analyzer

This comment has been minimized.

@petrochenkov
Copy link
Contributor

Blocked on the FCP in rust-lang/compiler-team#785.
@rustbot blocked

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 19, 2024
@bors

This comment was marked as resolved.

@Urgau Urgau force-pushed the check-cfg-test-userspace branch from 60ada7a to bda2e89 Compare October 21, 2024 17:14
github-merge-queue bot pushed a commit to rust-lang/cargo that referenced this pull request Dec 19, 2024
)

### What does this PR try to resolve?

This PR adds the `test` cfg as a well known Cargo cfg as
rust-lang/compiler-team#785 is now in FCP and
before the compiler change.

### How should we test and review this PR?

Look at the new argument passed and the test changes.

### Additional information

Detailed motivation at
rust-lang/compiler-team#785, but summary
`test` is a weird well known cfg for `rustc` as it's mostly a convention
and build system like Cargo may to set it conditionally (`lib.test =
false` for Cargo, not done in this PR).

Pre-require to rust-lang/rust#131729.

r? @epage
@Urgau
Copy link
Member Author

Urgau commented Dec 25, 2024

The FCP in rust-lang/compiler-team#785 has completed and the Cargo change was done rust-lang/cargo#14963. This PR is therefore unblocked and ready.

@rustbot labels -S-blocked -S-waiting-on-MCP +S-waiting-on-review +relnotes

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. relnotes Marks issues that should be documented in the release notes of the next release. and removed S-blocked Status: Blocked on something else such as an RFC or other implementation work. S-waiting-on-MCP Status: PR has a compiler MCP and is waiting for the compiler MCP to complete. labels Dec 25, 2024
@petrochenkov
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Jan 2, 2025

📌 Commit bda2e89 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 Jan 2, 2025
@Urgau Urgau force-pushed the check-cfg-test-userspace branch from bda2e89 to c73d81e Compare January 2, 2025 15:57
@Urgau
Copy link
Member Author

Urgau commented Jan 2, 2025

Rebased. CI is passing. Re-approving.

@bors r=petrochenkov

@bors
Copy link
Contributor

bors commented Jan 2, 2025

📌 Commit c73d81e has been approved by petrochenkov

It is now in the queue for this repository.

bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 3, 2025
…iaskrgr

Rollup of 4 pull requests

Successful merges:

 - rust-lang#131729 (Make the `test` cfg a userspace check-cfg)
 - rust-lang#134241 (more concrete source url of std docs [V2])
 - rust-lang#135042 (taint fcx on selection errors during unsizing)
 - rust-lang#135049 (Remove unused fields from RepeatElementCopy obligation)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 8439ae7 into rust-lang:master Jan 3, 2025
6 checks passed
@rustbot rustbot added this to the 1.85.0 milestone Jan 3, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 3, 2025
Rollup merge of rust-lang#131729 - Urgau:check-cfg-test-userspace, r=petrochenkov

Make the `test` cfg a userspace check-cfg

This PR implements MCP rust-lang/compiler-team#785, which makes the `test` cfg a "userspace" check-cfg, i.e. no longer included in the well known cfg list.

Things to do:

- [x] Accept the MCP (rust-lang/compiler-team#785 (comment))
- [x] Mark `test` in Cargo (rust-lang/cargo#14963)

`@rustbot` labels +S-waiting-on-MCP +F-check_cfg
r? `@petrochenkov`
littledivy added a commit to denoland/deno_core that referenced this pull request Jan 5, 2025
Pin the nightly version for now. Starting from nightly 2025-01-03, all
cfg(tests) produce compiler error:

```
error: unexpected `cfg` condition name: `test`
   --> ops/op2/mod.rs:363:7
    |
363 | #[cfg(test)]
    |       ^^^^
    |
    = help: expected names are: `clippy`, `debug_assertions`, `doc`, `docsrs`, `doctest`, `feature`, `fmt_debug`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `rustfmt`, `sanitize`, `sanitizer_cfi_generalize_pointers`, `sanitizer_cfi_normalize_integers`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `ub_checks`, `unix`, and `windows`
    = help: consider using a Cargo feature instead
    = help: or consider adding in `Cargo.toml` the `check-cfg` lint config for the lint:
             [lints.rust]
             unexpected_cfgs = { level = "warn", check-cfg = ['cfg(test)'] }
    = help: or consider adding `println!("cargo::rustc-check-cfg=cfg(test)");` to the top of the `build.rs`
    = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration
    = note: `-D unexpected-cfgs` implied by `-D warnings`
    = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]`
```

Seems related to rust-lang/rust#131729 and maybe
some changes haven't propagated to cargo yet?
scouten-adobe added a commit to contentauth/c2pa-rs that referenced this pull request Jan 7, 2025
scouten-adobe added a commit to contentauth/c2pa-rs that referenced this pull request Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc F-check-cfg --check-cfg relnotes Marks issues that should be documented in the release notes of the next release. 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
Development

Successfully merging this pull request may close these issues.

6 participants