1
Fork 0

compiler: die immediately instead of handling unknown target codegen

We cannot produce anything useful if asked to compile unknown targets.
We should handle the error immediately at the point of discovery instead
of propagating it upward, and preferably in the simplest way: Die.

This allows cleaning up our "error-handling" spread across 5 crates.
This commit is contained in:
Jubilee Young 2025-02-10 10:30:41 -08:00
parent 8c04e39595
commit 17716be86e
7 changed files with 7 additions and 63 deletions

View file

@ -46,15 +46,6 @@ fn unwrap_fn_abi<'tcx>(
span: tcx.def_span(item_def_id),
});
}
Err(FnAbiError::AdjustForForeignAbi(e)) => {
// Sadly there seems to be no `into_diagnostic` for this case... and I am not sure if
// this can even be reached. Anyway this is a perma-unstable debug attribute, an ICE
// isn't the worst thing. Also this matches what codegen does.
span_bug!(
tcx.def_span(item_def_id),
"error computing fn_abi_of_instance, cannot adjust for foreign ABI: {e:?}",
)
}
}
}