diff --git a/rust-version b/rust-version index f412399cc..df2bac877 100644 --- a/rust-version +++ b/rust-version @@ -1 +1 @@ -a1dbb443527bd126452875eb5d5860c1d001d761 +2f3f27bf79ec147fec9d2e7980605307a74067f4 diff --git a/src/building/bootstrapping/writing-tools-in-bootstrap.md b/src/building/bootstrapping/writing-tools-in-bootstrap.md index 41d0cf8d9..c3660e24b 100644 --- a/src/building/bootstrapping/writing-tools-in-bootstrap.md +++ b/src/building/bootstrapping/writing-tools-in-bootstrap.md @@ -11,11 +11,8 @@ There are three types of tools you can write in bootstrap: Use this for tools that rely on the locally built std. The output goes into the "stageN-tools" directory. This mode is rarely used, mainly for `compiletest` which requires `libtest`. -- **`Mode::ToolRustc`** - Use this for tools that depend on both the locally built `rustc` and the target `std`. This is more complex than - the other modes because the tool must be built with the same compiler used for `rustc` and placed in the "stageN-tools" - directory. When you choose `Mode::ToolRustc`, `ToolBuild` implementation takes care of this automatically. - If you need to use the builder’s compiler for something specific, you can get it from `ToolBuildResult`, which is +- **`Mode::ToolRustcPrivate`** + Use this for tools that use the `rustc_private` mechanism, and thus depend on the locally built `rustc` and its rlib artifacts. This is more complex than the other modes because the tool must be built with the same compiler used for `rustc` and placed in the "stageN-tools" directory. When you choose `Mode::ToolRustcPrivate`, `ToolBuild` implementation takes care of this automatically. If you need to use the builder’s compiler for something specific, you can get it from `ToolBuildResult`, which is returned by the tool's [`Step`]. Regardless of the tool type you must return `ToolBuildResult` from the tool’s [`Step`] implementation and use `ToolBuild` inside it. diff --git a/src/tests/adding.md b/src/tests/adding.md index e5c26bef1..46b8a1e4c 100644 --- a/src/tests/adding.md +++ b/src/tests/adding.md @@ -29,6 +29,8 @@ guidelines: suites. - Need to inspect the resulting binary in some way? Or if all the other test suites are too limited for your purposes? Then use `run-make`. + - Use `run-make-cargo` if you need to exercise in-tree `cargo` in conjunction + with in-tree `rustc`. - Check out the [compiletest] chapter for more specialized test suites. After deciding on which kind of test to add, see [best diff --git a/src/tests/best-practices.md b/src/tests/best-practices.md index be00207e3..efc626035 100644 --- a/src/tests/best-practices.md +++ b/src/tests/best-practices.md @@ -83,10 +83,10 @@ related tests. - E.g. for an implementation of RFC 2093 specifically, we can group a collection of tests under `tests/ui/rfc-2093-infer-outlives/`. For the directory name, include what the RFC is about. -- For the [`run-make`] test suite, each `rmake.rs` must be contained within an - immediate subdirectory under `tests/run-make/`. Further nesting is not - presently supported. Avoid including issue number in the directory name too, - include that info in a comment inside `rmake.rs`. +- For the [`run-make`]/`run-make-support` test suites, each `rmake.rs` must + be contained within an immediate subdirectory under `tests/run-make/` or + `tests/run-make-cargo/` respectively. Further nesting is not presently + supported. Avoid using _only_ an issue number for the test name as well. ## Test descriptions diff --git a/src/tests/compiletest.md b/src/tests/compiletest.md index 4980ed845..a4a729935 100644 --- a/src/tests/compiletest.md +++ b/src/tests/compiletest.md @@ -397,13 +397,19 @@ your test, causing separate files to be generated for 32bit and 64bit systems. ### `run-make` tests -The tests in [`tests/run-make`] are general-purpose tests using Rust *recipes*, -which are small programs (`rmake.rs`) allowing arbitrary Rust code such as -`rustc` invocations, and is supported by a [`run_make_support`] library. Using -Rust recipes provide the ultimate in flexibility. +The tests in [`tests/run-make`] and [`tests/run-make-cargo`] are general-purpose +tests using Rust *recipes*, which are small programs (`rmake.rs`) allowing +arbitrary Rust code such as `rustc` invocations, and is supported by a +[`run_make_support`] library. Using Rust recipes provide the ultimate in +flexibility. `run-make` tests should be used if no other test suites better suit your needs. +The `run-make-cargo` test suite additionally builds an in-tree `cargo` to support +use cases that require testing in-tree `cargo` in conjunction with in-tree `rustc`. +The `run-make` test suite does not have access to in-tree `cargo` (so it can be the +faster-to-iterate test suite). + #### Using Rust recipes Each test should be in a separate directory with a `rmake.rs` Rust program, @@ -476,6 +482,7 @@ Then add a corresponding entry to `"rust-analyzer.linkedProjects"` ``` [`tests/run-make`]: https://github.com/rust-lang/rust/tree/master/tests/run-make +[`tests/run-make-cargo`]: https://github.com/rust-lang/rust/tree/master/tests/run-make-cargo [`run_make_support`]: https://github.com/rust-lang/rust/tree/master/src/tools/run-make-support ### Coverage tests diff --git a/src/tests/directives.md b/src/tests/directives.md index f58ee669a..4be78fac4 100644 --- a/src/tests/directives.md +++ b/src/tests/directives.md @@ -52,14 +52,14 @@ not be exhaustive. Directives can generally be found by browsing the See [Building auxiliary crates](compiletest.html#building-auxiliary-crates) -| Directive | Explanation | Supported test suites | Possible values | -|-----------------------|-------------------------------------------------------------------------------------------------------|-----------------------|-----------------------------------------------| -| `aux-bin` | Build a aux binary, made available in `auxiliary/bin` relative to test directory | All except `run-make` | Path to auxiliary `.rs` file | -| `aux-build` | Build a separate crate from the named source file | All except `run-make` | Path to auxiliary `.rs` file | -| `aux-crate` | Like `aux-build` but makes available as extern prelude | All except `run-make` | `=` | -| `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 | -| `proc-macro` | Similar to `aux-build`, but for aux forces host and don't use `-Cprefer-dynamic`[^pm]. | All except `run-make` | Path to auxiliary proc-macro `.rs` file | -| `build-aux-docs` | Build docs for auxiliaries as well. Note that this only works with `aux-build`, not `aux-crate`. | All except `run-make` | N/A | +| Directive | Explanation | Supported test suites | Possible values | +|-----------------------|-------------------------------------------------------------------------------------------------------|----------------------------------------|-----------------------------------------------| +| `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 | +| `aux-build` | Build a separate crate from the named source file | All except `run-make`/`run-make-cargo` | Path to auxiliary `.rs` file | +| `aux-crate` | Like `aux-build` but makes available as extern prelude | All except `run-make`/`run-make-cargo` | `=` | +| `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 | +| `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 | +| `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 | [^pm]: please see the [Auxiliary proc-macro section](compiletest.html#auxiliary-proc-macro) in the compiletest chapter for specifics. @@ -243,18 +243,18 @@ ignoring debuggers. ### Affecting how tests are built -| Directive | Explanation | Supported test suites | Possible values | -|---------------------|----------------------------------------------------------------------------------------------|---------------------------|--------------------------------------------------------------------------------------------| -| `compile-flags` | Flags passed to `rustc` when building the test or aux file | All except for `run-make` | Any valid `rustc` flags, e.g. `-Awarnings -Dfoo`. Cannot be `-Cincremental` or `--edition` | -| `edition` | The edition used to build the test | All except for `run-make` | Any valid `--edition` value | -| `rustc-env` | Env var to set when running `rustc` | All except for `run-make` | `=` | -| `unset-rustc-env` | Env var to unset when running `rustc` | All except for `run-make` | Any env var name | -| `incremental` | Proper incremental support for tests outside of incremental test suite | `ui`, `crashes` | N/A | -| `no-prefer-dynamic` | Don't use `-C prefer-dynamic`, don't build as a dylib via a `--crate-type=dylib` preset flag | `ui`, `crashes` | N/A | +| Directive | Explanation | Supported test suites | Possible values | +|---------------------|----------------------------------------------------------------------------------------------|--------------------------------------------|--------------------------------------------------------------------------------------------| +| `compile-flags` | Flags passed to `rustc` when building the test or aux file | All except for `run-make`/`run-make-cargo` | Any valid `rustc` flags, e.g. `-Awarnings -Dfoo`. Cannot be `-Cincremental` or `--edition` | +| `edition` | The edition used to build the test | All except for `run-make`/`run-make-cargo` | Any valid `--edition` value | +| `rustc-env` | Env var to set when running `rustc` | All except for `run-make`/`run-make-cargo` | `=` | +| `unset-rustc-env` | Env var to unset when running `rustc` | All except for `run-make`/`run-make-cargo` | Any env var name | +| `incremental` | Proper incremental support for tests outside of incremental test suite | `ui`, `crashes` | N/A | +| `no-prefer-dynamic` | Don't use `-C prefer-dynamic`, don't build as a dylib via a `--crate-type=dylib` preset flag | `ui`, `crashes` | N/A |
-Tests (outside of `run-make`) that want to use incremental tests not in the +Tests (outside of `run-make`/`run-make-cargo`) that want to use incremental tests not in the incremental test-suite must not pass `-C incremental` via `compile-flags`, and must instead use the `//@ incremental` directive. @@ -264,9 +264,9 @@ Consider writing the test as a proper incremental test instead. ### Rustdoc -| Directive | Explanation | Supported test suites | Possible values | -|-------------|--------------------------------------------------------------|------------------------------------------|---------------------------| -| `doc-flags` | Flags passed to `rustdoc` when building the test or aux file | `rustdoc`, `rustdoc-js`, `rustdoc-json` | Any valid `rustdoc` flags | +| Directive | Explanation | Supported test suites | Possible values | +|-------------|--------------------------------------------------------------|-----------------------------------------|---------------------------| +| `doc-flags` | Flags passed to `rustdoc` when building the test or aux file | `rustdoc`, `rustdoc-js`, `rustdoc-json` | Any valid `rustdoc` flags |