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

Introduce a //@ needs-crate-type compiletest directive #139469

Merged
merged 3 commits into from
Apr 11, 2025

Conversation

jieyouxu
Copy link
Member

@jieyouxu jieyouxu commented Apr 7, 2025

The //@ needs-crate-type: $crate_types... directive takes a comma-separated list of crate types that the target platform must support in order for the test to be run. This allows the test writer to semantically convey that the ignore condition is based on target crate type needs, instead of using a general purpose //@ ignore-$target directive (often without comment).

Fixes #132309.

Example

//@ needs-crate-type: dylib (ignored on e.g. wasm32-unknown-unknown)
//@ compile-flags: --crate-type=dylib

fn foo() {}

Review advice

  • Best reviewed commit-by-commit.
  • The impl is not very clean, I briefly attempted to clean up the directive handling but found that more invasive changes are needed, so I'd like to not block on the cleanup for now.

try-job: test-various
try-job: armhf-gnu

@rustbot rustbot added A-compiletest Area: The compiletest test runner A-rustc-dev-guide Area: rustc-dev-guide 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 Apr 7, 2025
@jieyouxu
Copy link
Member Author

jieyouxu commented Apr 7, 2025

@rustbot blocked (#139279)

@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 Apr 7, 2025
@jieyouxu
Copy link
Member Author

jieyouxu commented Apr 7, 2025

Uhh maybe let me roll someone else, oli has a ton of PRs in review queue
r? @onur-ozkan

@rustbot rustbot assigned onur-ozkan and unassigned oli-obk Apr 7, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 7, 2025
…ss, r=<try>

[WIP] run-make-support: Calculate artifact names for target platform, not host platform

> [!CAUTION]
>
> Stacked on top of rust-lang#139469.

This was implemented incorrectly during the porting process, where we relied on std consts. However, `run-make-support` is a host-only library, which meant that these artifact names were for the *host* and not the *target*.

Helps with rust-lang#138066.

r? `@Kobzol`

try-job: armhf-gnu
try-job: test-various
try-job: x86_64-msvc-1
try-job: i686-msvc-1
try-job: x86_64-mingw-1
try-job: aarch64-apple
try-job: x86_64-apple-1
Copy link
Member

@onur-ozkan onur-ozkan left a comment

Choose a reason for hiding this comment

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

r=me when unblocked

@jieyouxu jieyouxu force-pushed the compiletest-supports-crate-type branch 2 times, most recently from 5dabccb to 3dbb4fd Compare April 7, 2025 07:52
@jieyouxu
Copy link
Member Author

jieyouxu commented Apr 7, 2025

@bors try

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 7, 2025
…type, r=<try>

Introduce a `//@ needs-crate-type` compiletest directive

> [!CAUTION]
>
> Blocked on bootstrap compiler bump rust-lang#139279 so I can get rid of the `cfg(not(bootstrap))` on the compiletest directive unit test.

The `//@ needs-crate-type: $crate_types...` directive takes a comma-separated list of crate types that the target platform must support in order for the test to be run. This allows the test writer to semantically convey that the ignore condition is based on target crate type needs, instead of using a general purpose `//@ ignore-$target` directive (often without comment).

Fixes rust-lang#132309.

### Example

```rs
//@ needs-crate-type: dylib (ignored on e.g. wasm32-unknown-unknown)
//@ compile-flags: --crate-type=dylib

fn foo() {}
```

### Review advice

- Best reviewed commit-by-commit.
- The impl is not very clean, I briefly attempted to clean up the directive handling but found that more invasive changes are needed, so I'd like to not block on the cleanup for now.

try-job: test-various
try-job: armhf-gnu
@bors
Copy link
Collaborator

bors commented Apr 7, 2025

⌛ Trying commit 3dbb4fd with merge 659206b...

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 7, 2025
…ss, r=<try>

[WIP] run-make-support: Calculate artifact names for target platform, not host platform

> [!CAUTION]
>
> Stacked on top of rust-lang#139469.

This was implemented incorrectly during the porting process, where we relied on std consts. However, `run-make-support` is a host-only library, which meant that these artifact names were for the *host* and not the *target*.

Helps with rust-lang#138066.

r? `@Kobzol`

try-job: armhf-gnu
try-job: test-various
try-job: x86_64-msvc-1
try-job: i686-msvc-1
try-job: x86_64-mingw-1
try-job: aarch64-apple
try-job: x86_64-apple-1
@bors
Copy link
Collaborator

bors commented Apr 7, 2025

☀️ Try build successful - checks-actions
Build commit: 659206b (659206be44de03c5829d9b0f18987a6b08e8c4da)

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 8, 2025
…ss, r=<try>

[WIP] run-make-support: Calculate artifact names for target platform, not host platform

> [!CAUTION]
>
> Stacked on top of rust-lang#139469.

This was implemented incorrectly during the porting process, where we relied on std consts. However, `run-make-support` is a host-only library, which meant that these artifact names were for the *host* and not the *target*.

Helps with rust-lang#138066.

r? `@Kobzol`

try-job: armhf-gnu
try-job: test-various
try-job: x86_64-msvc-1
try-job: i686-msvc-1
try-job: x86_64-mingw-1
try-job: aarch64-apple
try-job: x86_64-apple-1
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 10, 2025
…ss, r=<try>

[WIP] run-make-support: Calculate artifact names for target platform, not host platform

> [!CAUTION]
>
> Stacked on top of rust-lang#139469.

This was implemented incorrectly during the porting process, where we relied on std consts. However, `run-make-support` is a host-only library, which meant that these artifact names were for the *host* and not the *target*.

Helps with rust-lang#138066.

r? `@Kobzol`

try-job: armhf-gnu
try-job: test-various
try-job: x86_64-msvc-1
try-job: i686-msvc-1
try-job: x86_64-mingw-1
try-job: aarch64-apple
try-job: x86_64-apple-1
The `//@ needs-crate-type: $crate_types...` directive takes a
comma-separated list of crate types that the target platform must
support in order for the test to be run.
…directives

Not all existing tests are converted, I only updated ones that I can
easily find via directive comments.
@jieyouxu jieyouxu force-pushed the compiletest-supports-crate-type branch from 3dbb4fd to c615d10 Compare April 10, 2025 04:52
@jieyouxu
Copy link
Member Author

Bootstrap compiler bump was merged earlier, removed cfg(not(bootstrap)) from test.
@bors r=@onur-ozkan rollup

@bors
Copy link
Collaborator

bors commented Apr 10, 2025

📌 Commit c615d10 has been approved by onur-ozkan

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-blocked Status: Blocked on something else such as an RFC or other implementation work. labels Apr 10, 2025
@jieyouxu jieyouxu marked this pull request as ready for review April 10, 2025 04:54
@rustbot
Copy link
Collaborator

rustbot commented Apr 10, 2025

The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes.

cc @BoxyUwU, @jieyouxu, @Kobzol

bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 11, 2025
Rollup of 12 pull requests

Successful merges:

 - rust-lang#137447 (add `core::intrinsics::simd::{simd_extract_dyn, simd_insert_dyn}`)
 - rust-lang#138182 (rustc_target: update x86_win64 to match the documented calling convention for f128)
 - rust-lang#138682 (Allow drivers to supply a list of extra symbols to intern)
 - rust-lang#138904 (Test linking and running `no_std` binaries)
 - rust-lang#138998 (Don't suggest the use of  `impl Trait` in closure parameter)
 - rust-lang#139447 (doc changes: debug assertions -> overflow checks)
 - rust-lang#139469 (Introduce a `//@ needs-crate-type` compiletest directive)
 - rust-lang#139564 (Deeply normalize obligations in `BestObligation` folder)
 - rust-lang#139574 (bootstrap: improve `channel` handling)
 - rust-lang#139600 (Update `compiler-builtins` to 0.1.153)
 - rust-lang#139641 (Allow parenthesis around inferred array lengths)
 - rust-lang#139654 (Improve `AssocItem::descr`.)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit ea1a31b into rust-lang:master Apr 11, 2025
6 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 11, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Apr 11, 2025
Rollup merge of rust-lang#139469 - jieyouxu:compiletest-supports-crate-type, r=onur-ozkan

Introduce a `//@ needs-crate-type` compiletest directive

The `//@ needs-crate-type: $crate_types...` directive takes a comma-separated list of crate types that the target platform must support in order for the test to be run. This allows the test writer to semantically convey that the ignore condition is based on target crate type needs, instead of using a general purpose `//@ ignore-$target` directive (often without comment).

Fixes rust-lang#132309.

### Example

```rs
//@ needs-crate-type: dylib (ignored on e.g. wasm32-unknown-unknown)
//@ compile-flags: --crate-type=dylib

fn foo() {}
```

### Review advice

- Best reviewed commit-by-commit.
- The impl is not very clean, I briefly attempted to clean up the directive handling but found that more invasive changes are needed, so I'd like to not block on the cleanup for now.

try-job: test-various
try-job: armhf-gnu
@jieyouxu jieyouxu deleted the compiletest-supports-crate-type branch April 11, 2025 08:49
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 11, 2025
…ss, r=<try>

[WIP] run-make-support: Calculate artifact names for target platform, not host platform

> [!CAUTION]
>
> Stacked on top of rust-lang#139469.

This was implemented incorrectly during the porting process, where we relied on std consts. However, `run-make-support` is a host-only library, which meant that these artifact names were for the *host* and not the *target*.

Helps with rust-lang#138066.

r? `@Kobzol`

try-job: armhf-gnu
try-job: test-various
try-job: x86_64-msvc-1
try-job: i686-msvc-1
try-job: x86_64-mingw-1
try-job: aarch64-apple
try-job: x86_64-apple-1
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-rustc-dev-guide Area: rustc-dev-guide A-testsuite Area: The testsuite used to check the correctness of rustc 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.

compiletest: add a proper supports-crate-type: xxx directive
5 participants