about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
author许杰友 Jieyou Xu (Joe) <39484203+jieyouxu@users.noreply.github.com>2025-03-05 21:46:46 +0800
committerGitHub <noreply@github.com>2025-03-05 21:46:46 +0800
commitfe4c0850fe1ddfd1054d2c92cb832bb59edde2ea (patch)
tree7a4f9749a2a3cb7d327d693d5a0e9e7d0141dfda /compiler/rustc_mir_transform/src
parent9d1b2f7fda9845360c190b931a79acba495634e1 (diff)
parent8a689878ced1b3c0834ea32265c7d1cd43750db4 (diff)
downloadrust-fe4c0850fe1ddfd1054d2c92cb832bb59edde2ea.tar.gz
rust-fe4c0850fe1ddfd1054d2c92cb832bb59edde2ea.zip
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.
Diffstat (limited to 'compiler/rustc_mir_transform/src')
-rw-r--r--compiler/rustc_mir_transform/src/ffi_unwind_calls.rs6
1 files changed, 1 insertions, 5 deletions
diff --git a/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs b/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs
index 7b3553e7afd..abbff1c48dd 100644
--- a/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs
+++ b/compiler/rustc_mir_transform/src/ffi_unwind_calls.rs
@@ -53,11 +53,7 @@ fn has_ffi_unwind_calls(tcx: TyCtxt<'_>, local_def_id: LocalDefId) -> bool {
 
         // Rust calls cannot themselves create foreign unwinds.
         // We assume this is true for intrinsics as well.
-        if let ExternAbi::RustIntrinsic
-        | ExternAbi::Rust
-        | ExternAbi::RustCall
-        | ExternAbi::RustCold = sig.abi()
-        {
+        if sig.abi().is_rustic_abi() {
             continue;
         };