|
| 1 | +//! Check that `rustc`'s `--crate-type` flag accepts `--crate-type=<valid_type>` as well as the |
| 2 | +//! multi-value version `--crate-type=<valid_type_1>,<valid_type_2>`. |
| 3 | +//! |
| 4 | +//! This test does not try to check if the output artifacts are valid. |
| 5 | +
|
| 6 | +// FIXME(#132309): add a proper `supports-crate-type` directive. |
| 7 | + |
| 8 | +// Single valid crate types should pass |
| 9 | +//@ revisions: lib rlib staticlib dylib cdylib bin proc_dash_macro |
| 10 | + |
| 11 | +//@[lib] compile-flags: --crate-type=lib |
| 12 | +//@[lib] check-pass |
| 13 | + |
| 14 | +//@[rlib] compile-flags: --crate-type=rlib |
| 15 | +//@[rlib] check-pass |
| 16 | + |
| 17 | +//@[staticlib] compile-flags: --crate-type=staticlib |
| 18 | +//@[staticlib] check-pass |
| 19 | + |
| 20 | +//@[dylib] ignore-musl (dylibs are not supported) |
| 21 | +//@[dylib] ignore-wasm (dylibs are not supported) |
| 22 | +//@[dylib] compile-flags: --crate-type=dylib |
| 23 | +//@[dylib] check-pass |
| 24 | + |
| 25 | +//@[cdylib] ignore-musl (cdylibs are not supported) |
| 26 | +//@[cdylib] compile-flags: --crate-type=cdylib |
| 27 | +//@[cdylib] check-pass |
| 28 | + |
| 29 | +//@[bin] compile-flags: --crate-type=bin |
| 30 | +//@[bin] check-pass |
| 31 | + |
| 32 | +//@[proc_dash_macro] ignore-wasm (proc-macro is not supported) |
| 33 | +//@[proc_dash_macro] compile-flags: --crate-type=proc-macro |
| 34 | +//@[proc_dash_macro] check-pass |
| 35 | + |
| 36 | +//@ revisions: multivalue multivalue_combined |
| 37 | + |
| 38 | +//@[multivalue] compile-flags: --crate-type=lib,rlib,staticlib |
| 39 | +//@[multivalue] check-pass |
| 40 | + |
| 41 | +//@[multivalue_combined] ignore-musl (dylibs are not supported) |
| 42 | +//@[multivalue_combined] ignore-wasm (dylibs are not supported) |
| 43 | +//@[multivalue_combined] compile-flags: --crate-type=lib,rlib,staticlib --crate-type=dylib |
| 44 | +//@[multivalue_combined] check-pass |
| 45 | + |
| 46 | +// `proc-macro` is accepted, but `proc_macro` is not. |
| 47 | +//@ revisions: proc_underscore_macro |
| 48 | +//@[proc_underscore_macro] compile-flags: --crate-type=proc_macro |
| 49 | +//@[proc_underscore_macro] error-pattern: "unknown crate type: `proc_macro`" |
| 50 | + |
| 51 | +// Empty `--crate-type` not accepted. |
| 52 | +//@ revisions: empty_crate_type |
| 53 | +//@[empty_crate_type] compile-flags: --crate-type= |
| 54 | +//@[empty_crate_type] error-pattern: "unknown crate type: ``" |
| 55 | + |
| 56 | +// Random unknown crate type. Also check that we can handle non-ASCII. |
| 57 | +//@ revisions: unknown |
| 58 | +//@[unknown] compile-flags: --crate-type=🤡 |
| 59 | +//@[unknown] error-pattern: "unknown crate type: `🤡`" |
| 60 | + |
| 61 | +fn main() {} |
0 commit comments