From a657539291f52108d243e011dbad062bd80c1f9e Mon Sep 17 00:00:00 2001 From: Aelin Reidel Date: Fri, 5 Jun 2026 04:05:28 +0200 Subject: [PATCH] rustc_target: callconv: powerpc64: Remove unreachable fallback code path This is effectively dead code now that we validate the target spec, so let's mark it as unreachable to avoid misleading people looking at this code. --- .../rustc_target/src/callconv/powerpc64.rs | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/compiler/rustc_target/src/callconv/powerpc64.rs b/compiler/rustc_target/src/callconv/powerpc64.rs index 6a8a6841781c9..3eb40abe90f33 100644 --- a/compiler/rustc_target/src/callconv/powerpc64.rs +++ b/compiler/rustc_target/src/callconv/powerpc64.rs @@ -2,7 +2,7 @@ // Alignment of 128 bit types is not currently handled, this will // need to be fixed when PowerPC vector support is added. -use rustc_abi::{Endian, HasDataLayout, TyAbiInterface}; +use rustc_abi::{HasDataLayout, TyAbiInterface}; use crate::callconv::{Align, ArgAbi, FnAbi, Reg, RegKind, Uniform}; use crate::spec::{HasTargetSpec, LlvmAbi, Os}; @@ -106,17 +106,13 @@ where Ty: TyAbiInterface<'a, C> + Copy, C: HasDataLayout + HasTargetSpec, { - let abi = if cx.target_spec().options.llvm_abiname == LlvmAbi::ElfV2 { - ELFv2 - } else if cx.target_spec().options.llvm_abiname == LlvmAbi::ElfV1 { - ELFv1 - } else if cx.target_spec().os == Os::Aix { - AIX - } else { - match cx.data_layout().endian { - Endian::Big => ELFv1, - Endian::Little => ELFv2, - } + let abi = match cx.target_spec().options.llvm_abiname { + LlvmAbi::ElfV1 => ELFv1, + LlvmAbi::ElfV2 => ELFv2, + LlvmAbi::Unspecified if cx.target_spec().os == Os::Aix => AIX, + // Target::check_consistency enforces that every target except AIX + // sets llvm_abiname to either ElfV1 or ElfV2 + _ => unreachable!(), }; classify(cx, &mut fn_abi.ret, abi, true);