Skip to content

Commit a6bbbd8

Browse files
authored
Rollup merge of #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 #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
2 parents f69bf05 + 5fb6b8e commit a6bbbd8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tests/directives.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,13 @@ settings:
191191
specified atomic widths, e.g. the test with `//@ needs-target-has-atomic: 8,
192192
16, ptr` will only run if it supports the comma-separated list of atomic
193193
widths.
194-
- `needs-dynamic-linking` - ignores if target does not support dynamic linking
194+
- `needs-dynamic-linking` ignores if target does not support dynamic linking
195195
(which is orthogonal to it being unable to create `dylib` and `cdylib` crate types)
196+
- `needs-crate-type` — ignores if target platform does not support one or more
197+
of the comma-delimited list of specified crate types. For example,
198+
`//@ needs-crate-type: cdylib, proc-macro` will cause the test to be ignored
199+
on `wasm32-unknown-unknown` target because the target does not support the
200+
`proc-macro` crate type.
196201

197202
The following directives will check LLVM support:
198203

0 commit comments

Comments
 (0)