about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTshepang Mbambo <tshepang@gmail.com>2025-04-03 01:43:06 +0200
committerTshepang Mbambo <tshepang@gmail.com>2025-04-03 01:43:06 +0200
commit842da5c1ae4225b39958912e136ee6e708f3c6c6 (patch)
treed2fac66afaf3d34df389e33bd7a81b8bba0a426d
parent5c2a32296dea18b3e295b351c8375cd83d6d5643 (diff)
downloadrust-842da5c1ae4225b39958912e136ee6e708f3c6c6.tar.gz
rust-842da5c1ae4225b39958912e136ee6e708f3c6c6.zip
structure the message
-rw-r--r--compiler/rustc_session/src/config.rs10
-rw-r--r--tests/ui/errors/wrong-target-spec.stderr4
2 files changed, 9 insertions, 5 deletions
diff --git a/compiler/rustc_session/src/config.rs b/compiler/rustc_session/src/config.rs
index 3e2579b3f1d..120fabf3735 100644
--- a/compiler/rustc_session/src/config.rs
+++ b/compiler/rustc_session/src/config.rs
@@ -1423,10 +1423,12 @@ pub fn build_target_config(
             }
             target
         }
-        Err(e) => early_dcx.early_fatal(format!(
-            "error loading target specification: {e}; \
-                     run `rustc --print target-list` for a list of built-in targets"
-        )),
+        Err(e) => {
+            let mut err =
+                early_dcx.early_struct_fatal(format!("error loading target specification: {e}"));
+            err.help("run `rustc --print target-list` for a list of built-in targets");
+            err.emit();
+        }
     }
 }
 
diff --git a/tests/ui/errors/wrong-target-spec.stderr b/tests/ui/errors/wrong-target-spec.stderr
index 35850a4adf2..98b03ae00cb 100644
--- a/tests/ui/errors/wrong-target-spec.stderr
+++ b/tests/ui/errors/wrong-target-spec.stderr
@@ -1,2 +1,4 @@
-error: error loading target specification: could not find specification for target "x86_64_unknown-linux-musl"; run `rustc --print target-list` for a list of built-in targets
+error: error loading target specification: could not find specification for target "x86_64_unknown-linux-musl"
+  |
+  = help: run `rustc --print target-list` for a list of built-in targets