about summary refs log tree commit diff
path: root/compiler/rustc_parse/src/errors.rs
diff options
context:
space:
mode:
authorJacob Pratt <jacob@jhpratt.dev>2025-09-04 01:43:21 -0400
committerGitHub <noreply@github.com>2025-09-04 01:43:21 -0400
commitbe1d82991024c6dd029e2aded934a2d6fcfadc13 (patch)
treeb23c807c4042dc60b6666411920ef6fa2b18d217 /compiler/rustc_parse/src/errors.rs
parent00d5dc5c9d0a304020c7eb75562a415cf0e23806 (diff)
parentc2ae2e03d2ab371adab0b16d0c2dba1b5f51e17c (diff)
downloadrust-be1d82991024c6dd029e2aded934a2d6fcfadc13.tar.gz
rust-be1d82991024c6dd029e2aded934a2d6fcfadc13.zip
Rollup merge of #146119 - Zalathar:capture, r=jieyouxu
compiletest: Implement an experimental `--new-output-capture` mode

Thanks to the efforts on rust-lang/rust#140192, compiletest no longer has an unstable dependency on libtest, but it still has an unstable dependency on `#![feature(internal_output_capture)]`. That makes building compiletest more complicated than for most other bootstrap tools.

This PR therefore adds opt-in support for an experimental compiletest mode that avoids the use of `internal_output_capture` APIs, and instead uses more mundane means to capture the output of individual test runners.

Each `TestCx` now contains `&dyn ConsoleOut` references for stdout and stderr. All print statements in `compiletests::runtest` have been replaced with `write!` or `writeln!` calls that explicitly write to one of those trait objects. The underlying implementation then forwards to `print!` or `eprint!` (for `--no-capture` or old-output-capture mode), or writes to a separate buffer (in new-output-capture mode).

---

Currently, new-output-capture is disabled by default. It can be explicitly enabled in one of two ways:

- When running `x test`, pass `--new-output-capture=on` as a *compiletest* argument (after `--`).
  - E.g. `x test ui -- --new-output-capture=on`.
  - The short form is `-Non` or `-Ny`.
- Set environment variable `COMPILETEST_NEW_OUTPUT_CAPTURE=on`.

After some amount of opt-in testing, new-output-capture will become the default (with a temporary opt-out). Eventually, old-output-capture and `#![feature(internal_output_capture)]` will be completely removed from compiletest.

r? jieyouxu
Diffstat (limited to 'compiler/rustc_parse/src/errors.rs')
0 files changed, 0 insertions, 0 deletions