-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Conversation
Some changes occurred in src/tools/compiletest cc @jieyouxu |
This comment has been minimized.
This comment has been minimized.
ef799aa
to
60ada7a
Compare
Blocked on the FCP in rust-lang/compiler-team#785. |
This comment was marked as resolved.
This comment was marked as resolved.
60ada7a
to
bda2e89
Compare
) ### 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
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 |
@bors r+ |
bda2e89
to
c73d81e
Compare
Rebased. CI is passing. Re-approving. @bors r=petrochenkov |
…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
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`
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?
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:
test
in Cargo (Add thetest
cfg as a well known cfg before of compiler change cargo#14963)@rustbot labels +S-waiting-on-MCP +F-check_cfg
r? @petrochenkov