Skip to content

Commit 414da5b

Browse files
committed
Auto merge of #138906 - thaliaarchi:unsupported-test-exe, r=bjorn3
Reject test executables when not supported by target Currently, compiling tests for SOLID produces an ICE, because SOLID does not support executables. See #138047
2 parents 40dacd5 + 59e5920 commit 414da5b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

Diff for: compiler/rustc_session/src/output.rs

+7
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ pub fn collect_crate_types(session: &Session, attrs: &[ast::Attribute]) -> Vec<C
177177
// If we're generating a test executable, then ignore all other output
178178
// styles at all other locations
179179
if session.opts.test {
180+
if !session.target.executables {
181+
session.dcx().emit_warn(errors::UnsupportedCrateTypeForTarget {
182+
crate_type: CrateType::Executable,
183+
target_triple: &session.opts.target_triple,
184+
});
185+
return Vec::new();
186+
}
180187
return vec![CrateType::Executable];
181188
}
182189

0 commit comments

Comments
 (0)