about summary refs log tree commit diff
diff options
context:
space:
mode:
authorThalia Archibald <thalia@archibald.dev>2025-03-05 15:28:38 -0800
committerThalia Archibald <thalia@archibald.dev>2025-03-24 14:25:30 -0700
commit59e5920e298d7690d455b13adf31b11485b25dcd (patch)
treef2287a54a1110229c35fce8d938b52a7702551c7
parent4510e86a41388733675465a8647d4235f3bf2023 (diff)
downloadrust-59e5920e298d7690d455b13adf31b11485b25dcd.tar.gz
rust-59e5920e298d7690d455b13adf31b11485b25dcd.zip
Reject test executables when not supported by target
Currently, compiling tests for SOLID produces an ICE, because SOLID does
not support executables.
-rw-r--r--compiler/rustc_session/src/output.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_session/src/output.rs b/compiler/rustc_session/src/output.rs
index b37a80274c0..2b7420cb1b2 100644
--- a/compiler/rustc_session/src/output.rs
+++ b/compiler/rustc_session/src/output.rs
@@ -177,6 +177,13 @@ pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec<C
     // If we're generating a test executable, then ignore all other output
     // styles at all other locations
     if session.opts.test {
+        if !session.target.executables {
+            session.dcx().emit_warn(errors::UnsupportedCrateTypeForTarget {
+                crate_type: CrateType::Executable,
+                target_triple: &session.opts.target_triple,
+            });
+            return Vec::new();
+        }
         return vec![CrateType::Executable];
     }