Reject test executables when not supported by target

Currently, compiling tests for SOLID produces an ICE, because SOLID does
not support executables.
This commit is contained in:
Thalia Archibald 2025-03-05 15:28:38 -08:00
parent 4510e86a41
commit 59e5920e29

View file

@ -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];
}