Skip to content

Commit c615d10

Browse files
committed
tests: use specific-purpose needs-crate-type over ignore-$target directives
Not all existing tests are converted, I only updated ones that I can easily find via directive comments.
1 parent 5fe7712 commit c615d10

10 files changed

+31
-38
lines changed

tests/ui/invalid-compile-flags/crate-type-flag.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
//!
44
//! This test does not try to check if the output artifacts are valid.
55
6-
// FIXME(#132309): add a proper `supports-crate-type` directive.
7-
86
// Single valid crate types should pass
97
//@ revisions: lib rlib staticlib dylib cdylib bin proc_dash_macro
108

@@ -17,19 +15,18 @@
1715
//@[staticlib] compile-flags: --crate-type=staticlib
1816
//@[staticlib] check-pass
1917

20-
//@[dylib] ignore-musl (dylib is supported, but musl libc is statically linked by default)
21-
//@[dylib] ignore-wasm (dylib is not supported)
18+
//@[dylib] needs-crate-type: dylib
2219
//@[dylib] compile-flags: --crate-type=dylib
2320
//@[dylib] check-pass
2421

25-
//@[cdylib] ignore-musl (cdylib is supported, but musl libc is statically linked by default)
22+
//@[cdylib] needs-crate-type: cdylib
2623
//@[cdylib] compile-flags: --crate-type=cdylib
2724
//@[cdylib] check-pass
2825

2926
//@[bin] compile-flags: --crate-type=bin
3027
//@[bin] check-pass
3128

32-
//@[proc_dash_macro] ignore-wasm (proc-macro is not supported)
29+
//@[proc_dash_macro] needs-crate-type: proc-macro
3330
//@[proc_dash_macro] needs-unwind (panic=abort causes warning to be emitted)
3431
//@[proc_dash_macro] compile-flags: --crate-type=proc-macro
3532
//@[proc_dash_macro] check-pass

tests/ui/linkage-attr/issue-12133-3.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
//@ aux-build:issue-12133-rlib.rs
33
//@ aux-build:issue-12133-dylib.rs
44
//@ aux-build:issue-12133-dylib2.rs
5-
//@ ignore-wasm32 no dylib support
6-
//@ ignore-musl
5+
//@ needs-crate-type: dylib
76
//@ needs-dynamic-linking
87

98

tests/ui/lint/non-snake-case/lint-non-snake-case-crate.cdylib_.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: crate `NonSnakeCase` should have a snake case name
2-
--> $DIR/lint-non-snake-case-crate.rs:36:18
2+
--> $DIR/lint-non-snake-case-crate.rs:35:18
33
|
44
LL | #![crate_name = "NonSnakeCase"]
55
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
66
|
77
note: the lint level is defined here
8-
--> $DIR/lint-non-snake-case-crate.rs:38:9
8+
--> $DIR/lint-non-snake-case-crate.rs:37:9
99
|
1010
LL | #![deny(non_snake_case)]
1111
| ^^^^^^^^^^^^^^

tests/ui/lint/non-snake-case/lint-non-snake-case-crate.dylib_.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: crate `NonSnakeCase` should have a snake case name
2-
--> $DIR/lint-non-snake-case-crate.rs:36:18
2+
--> $DIR/lint-non-snake-case-crate.rs:35:18
33
|
44
LL | #![crate_name = "NonSnakeCase"]
55
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
66
|
77
note: the lint level is defined here
8-
--> $DIR/lint-non-snake-case-crate.rs:38:9
8+
--> $DIR/lint-non-snake-case-crate.rs:37:9
99
|
1010
LL | #![deny(non_snake_case)]
1111
| ^^^^^^^^^^^^^^

tests/ui/lint/non-snake-case/lint-non-snake-case-crate.lib_.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: crate `NonSnakeCase` should have a snake case name
2-
--> $DIR/lint-non-snake-case-crate.rs:36:18
2+
--> $DIR/lint-non-snake-case-crate.rs:35:18
33
|
44
LL | #![crate_name = "NonSnakeCase"]
55
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
66
|
77
note: the lint level is defined here
8-
--> $DIR/lint-non-snake-case-crate.rs:38:9
8+
--> $DIR/lint-non-snake-case-crate.rs:37:9
99
|
1010
LL | #![deny(non_snake_case)]
1111
| ^^^^^^^^^^^^^^

tests/ui/lint/non-snake-case/lint-non-snake-case-crate.proc_macro_.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: crate `NonSnakeCase` should have a snake case name
2-
--> $DIR/lint-non-snake-case-crate.rs:36:18
2+
--> $DIR/lint-non-snake-case-crate.rs:35:18
33
|
44
LL | #![crate_name = "NonSnakeCase"]
55
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
66
|
77
note: the lint level is defined here
8-
--> $DIR/lint-non-snake-case-crate.rs:38:9
8+
--> $DIR/lint-non-snake-case-crate.rs:37:9
99
|
1010
LL | #![deny(non_snake_case)]
1111
| ^^^^^^^^^^^^^^

tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rlib_.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: crate `NonSnakeCase` should have a snake case name
2-
--> $DIR/lint-non-snake-case-crate.rs:36:18
2+
--> $DIR/lint-non-snake-case-crate.rs:35:18
33
|
44
LL | #![crate_name = "NonSnakeCase"]
55
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
66
|
77
note: the lint level is defined here
8-
--> $DIR/lint-non-snake-case-crate.rs:38:9
8+
--> $DIR/lint-non-snake-case-crate.rs:37:9
99
|
1010
LL | #![deny(non_snake_case)]
1111
| ^^^^^^^^^^^^^^

tests/ui/lint/non-snake-case/lint-non-snake-case-crate.rs

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,27 @@
1010

1111
// But should fire on non-binary crates.
1212

13-
// FIXME(#132309): dylib crate type is not supported on wasm; we need a proper
14-
// supports-crate-type directive. Also, needs-dynamic-linking should rule out
15-
// musl since it supports neither dylibs nor cdylibs.
16-
//@[dylib_] ignore-wasm
17-
//@[dylib_] ignore-musl
18-
//@[cdylib_] ignore-musl
19-
20-
//@[dylib_] needs-dynamic-linking
13+
//@[cdylib_] compile-flags: --crate-type=cdylib
2114
//@[cdylib_] needs-dynamic-linking
22-
//@[proc_macro_] force-host
23-
//@[proc_macro_] no-prefer-dynamic
15+
//@[cdylib_] needs-crate-type: cdylib
2416

25-
//@[cdylib_] compile-flags: --crate-type=cdylib
2617
//@[dylib_] compile-flags: --crate-type=dylib
18+
//@[dylib_] needs-dynamic-linking
19+
//@[dylib_] needs-crate-type: dylib
20+
2721
//@[lib_] compile-flags: --crate-type=lib
22+
23+
//@[proc_macro_] force-host
24+
//@[proc_macro_] no-prefer-dynamic
2825
//@[proc_macro_] compile-flags: --crate-type=proc-macro
26+
// The compiler may emit a warning that causes stderr output that contains a warning this test does
27+
// not wish to check.
28+
//@[proc_macro_] needs-unwind
29+
//@[proc_macro_] needs-crate-type: proc-macro
30+
2931
//@[rlib_] compile-flags: --crate-type=rlib
30-
//@[staticlib_] compile-flags: --crate-type=staticlib
3132

32-
// The compiler may emit a warning that causes stderr output
33-
// that contains a warning this test does not wish to check.
34-
//@[proc_macro_] needs-unwind
33+
//@[staticlib_] compile-flags: --crate-type=staticlib
3534

3635
#![crate_name = "NonSnakeCase"]
3736
//[cdylib_,dylib_,lib_,proc_macro_,rlib_,staticlib_]~^ ERROR crate `NonSnakeCase` should have a snake case name

tests/ui/lint/non-snake-case/lint-non-snake-case-crate.staticlib_.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
error: crate `NonSnakeCase` should have a snake case name
2-
--> $DIR/lint-non-snake-case-crate.rs:36:18
2+
--> $DIR/lint-non-snake-case-crate.rs:35:18
33
|
44
LL | #![crate_name = "NonSnakeCase"]
55
| ^^^^^^^^^^^^ help: convert the identifier to snake case: `non_snake_case`
66
|
77
note: the lint level is defined here
8-
--> $DIR/lint-non-snake-case-crate.rs:38:9
8+
--> $DIR/lint-non-snake-case-crate.rs:37:9
99
|
1010
LL | #![deny(non_snake_case)]
1111
| ^^^^^^^^^^^^^^

tests/ui/panic-runtime/abort-link-to-unwind-dylib.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
//@ build-fail
22
//@ compile-flags:-C panic=abort -C prefer-dynamic
33
//@ needs-unwind
4-
//@ ignore-musl - no dylibs here
5-
//@ ignore-emscripten
6-
//@ ignore-sgx no dynamic lib support
4+
//@ needs-crate-type: dylib
75

86
// This is a test where the local crate, compiled with `panic=abort`, links to
97
// the standard library **dynamically** which is already linked against

0 commit comments

Comments
 (0)