Skip to content

Commit 7f2dea0

Browse files
authored
Rollup merge of #151353 - Enselic:aux-crate-opts, r=Zalathar
compiletest: Make `aux-crate` directive explicitly handle `--extern` modifiers With `-Zunstable-options` it is possible to pass options to `--extern`. See here for an exhaustive list of possible options: https://github.com/rust-lang/rust/blob/b5dd72d2921500c9d9e15f074e1d831adcaa3dee/compiler/rustc_session/src/config.rs#L2356-L2367 Using these options works with the `aux-crate` directive, but only because the options pretend to be part of the name. Make it clearer what `aux-crate` supports by explicitly handling `--extern` options. This PR is step one of splitting up rust-lang/rust#151258 into smaller pieces. r? @Zalathar
2 parents 4935411 + 710389f commit 7f2dea0

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

src/tests/compiletest.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,9 @@ to link to the extern crate to make the crate be available as an extern prelude.
665665
That allows you to specify the additional syntax of the `--extern` flag, such as
666666
renaming a dependency. For example, `//@ aux-crate:foo=bar.rs` will compile
667667
`auxiliary/bar.rs` and make it available under then name `foo` within the test.
668-
This is similar to how Cargo does dependency renaming.
668+
This is similar to how Cargo does dependency renaming. It is also possible to
669+
specify [`--extern` modifiers](https://github.com/rust-lang/rust/issues/98405).
670+
For example, `//@ aux-crate:noprelude:foo=bar.rs`.
669671

670672
`aux-bin` is similar to `aux-build` but will build a binary instead of a
671673
library. The binary will be available in `auxiliary/bin` relative to the working

src/tests/directives.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ Directives can generally be found by browsing the
5353

5454
See [Building auxiliary crates](compiletest.html#building-auxiliary-crates)
5555

56-
| Directive | Explanation | Supported test suites | Possible values |
57-
|-----------------------|-------------------------------------------------------------------------------------------------------|----------------------------------------|-----------------------------------------------|
58-
| `aux-bin` | Build a aux binary, made available in `auxiliary/bin` relative to test directory | All except `run-make`/`run-make-cargo` | Path to auxiliary `.rs` file |
59-
| `aux-build` | Build a separate crate from the named source file | All except `run-make`/`run-make-cargo` | Path to auxiliary `.rs` file |
60-
| `aux-crate` | Like `aux-build` but makes available as extern prelude | All except `run-make`/`run-make-cargo` | `<extern_prelude_name>=<path/to/aux/file.rs>` |
61-
| `aux-codegen-backend` | Similar to `aux-build` but pass the compiled dylib to `-Zcodegen-backend` when building the main file | `ui-fulldeps` | Path to codegen backend file |
62-
| `proc-macro` | Similar to `aux-build`, but for aux forces host and don't use `-Cprefer-dynamic`[^pm]. | All except `run-make`/`run-make-cargo` | Path to auxiliary proc-macro `.rs` file |
63-
| `build-aux-docs` | Build docs for auxiliaries as well. Note that this only works with `aux-build`, not `aux-crate`. | All except `run-make`/`run-make-cargo` | N/A |
56+
| Directive | Explanation | Supported test suites | Possible values |
57+
|-----------------------|-------------------------------------------------------------------------------------------------------|----------------------------------------|--------------------------------------------------------------------|
58+
| `aux-bin` | Build a aux binary, made available in `auxiliary/bin` relative to test directory | All except `run-make`/`run-make-cargo` | Path to auxiliary `.rs` file |
59+
| `aux-build` | Build a separate crate from the named source file | All except `run-make`/`run-make-cargo` | Path to auxiliary `.rs` file |
60+
| `aux-crate` | Like `aux-build` but makes available as extern prelude | All except `run-make`/`run-make-cargo` | `[<extern_modifiers>:]<extern_prelude_name>=<path/to/aux/file.rs>` |
61+
| `aux-codegen-backend` | Similar to `aux-build` but pass the compiled dylib to `-Zcodegen-backend` when building the main file | `ui-fulldeps` | Path to codegen backend file |
62+
| `proc-macro` | Similar to `aux-build`, but for aux forces host and don't use `-Cprefer-dynamic`[^pm]. | All except `run-make`/`run-make-cargo` | Path to auxiliary proc-macro `.rs` file |
63+
| `build-aux-docs` | Build docs for auxiliaries as well. Note that this only works with `aux-build`, not `aux-crate`. | All except `run-make`/`run-make-cargo` | N/A |
6464

6565
[^pm]: please see the [Auxiliary proc-macro section](compiletest.html#auxiliary-proc-macro) in the compiletest chapter for specifics.
6666

0 commit comments

Comments
 (0)