about summary refs log tree commit diff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-07-05 06:18:46 +0000
committerbors <bors@rust-lang.org>2023-07-05 06:18:46 +0000
commit6dab6dc5fcd9655adfa7bfb3e59e5cae487184d2 (patch)
treee0db27e4c7f547bc92e3d239d3872a5ecc0f90b8 /src/bootstrap
parent9227ff28aff55b252314076fcf21c9a66f10ac1e (diff)
parent6a1c10bd85442f52f1d55d51005481cfa5cb40b5 (diff)
downloadrust-6dab6dc5fcd9655adfa7bfb3e59e5cae487184d2.tar.gz
rust-6dab6dc5fcd9655adfa7bfb3e59e5cae487184d2.zip
Auto merge of #112697 - tgross35:explain-markdown, r=oli-obk
Add simple markdown formatting to `rustc --explain` output

This is a second attempt at #104540, which is #63128 without dependencies.

This PR adds basic markdown formatting to `rustc --explain` output when available. Currently, the output just displays raw markdown: this works of course, but it really doesn't look very elegant. (output is `rustc --explain E0038`)

<img width="583" alt="image" src="https://github.com/rust-lang/rust/assets/13724985/ea418117-47af-455b-83c0-6fc59276efee">

After this patch, sample output from the same file:

<img width="693" alt="image" src="https://github.com/rust-lang/rust/assets/13724985/12f7bf9b-a3fe-4104-b74b-c3e5227f3de9">

This also obeys the `--color always/auto/never` command option. Behavior:

- If pager is available and supports color, print with formatting to the pager
- If pager is not available or fails print with formatting to stdout - otherwise without formatting
- Follow `--color always/never` if suppied
- If everything fails, just print plain text to stdout

r? `@oli-obk`
cc `@estebank`
(since the two of you were involved in the previous discussion)
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/test.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 75e7bd6aa24..e4cc88c64a5 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -2219,6 +2219,11 @@ fn prepare_cargo_test(
 ) -> Command {
     let mut cargo = cargo.into();
 
+    // If bless is passed, give downstream crates a way to use it
+    if builder.config.cmd.bless() {
+        cargo.env("RUSTC_BLESS", "1");
+    }
+
     // Pass in some standard flags then iterate over the graph we've discovered
     // in `cargo metadata` with the maps above and figure out what `-p`
     // arguments need to get passed.