Rollup merge of #138028 - workingjubilee:is-rustic-abi, r=compiler-errors
compiler: add `ExternAbi::is_rustic_abi` Various parts of the compiler were hand-rolling this extremely simple check that is nonetheless easy to get wrong as the compiler evolves over time. Discourage them from being so "original" again by replacing it with a single implementation on the type that represents these ABIs. This simplifies a surprising amount of code as a result. Also fixes #132981, an ICE that emerged due to other checks being made stricter.
This commit is contained in:
commit
fe4c0850fe
7 changed files with 34 additions and 43 deletions
|
@ -436,10 +436,7 @@ fn fn_abi_sanity_check<'tcx>(
|
|||
) {
|
||||
let tcx = cx.tcx();
|
||||
|
||||
if spec_abi == ExternAbi::Rust
|
||||
|| spec_abi == ExternAbi::RustCall
|
||||
|| spec_abi == ExternAbi::RustCold
|
||||
{
|
||||
if spec_abi.is_rustic_abi() {
|
||||
if arg.layout.is_zst() {
|
||||
// Casting closures to function pointers depends on ZST closure types being
|
||||
// omitted entirely in the calling convention.
|
||||
|
@ -687,7 +684,7 @@ fn fn_abi_adjust_for_abi<'tcx>(
|
|||
|
||||
let tcx = cx.tcx();
|
||||
|
||||
if abi == ExternAbi::Rust || abi == ExternAbi::RustCall || abi == ExternAbi::RustIntrinsic {
|
||||
if abi.is_rustic_abi() {
|
||||
fn_abi.adjust_for_rust_abi(cx, abi);
|
||||
|
||||
// Look up the deduced parameter attributes for this function, if we have its def ID and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue