Skip to content

Commit c6ab758

Browse files
committed
Switch from tuple matching to match guards
1 parent 07a63e6 commit c6ab758

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

compiler/rustc_codegen_llvm/src/va_arg.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -173,26 +173,24 @@ pub(super) fn emit_va_arg(
173173
// is lacking in some instances, so we should only use it as a fallback.
174174
let target = &bx.cx.tcx.sess.target;
175175
let arch = &bx.cx.tcx.sess.target.arch;
176-
match (&**arch, target.options.is_like_windows) {
176+
match &**arch {
177177
// Windows x86
178-
("x86", true) => {
178+
"x86" if target.options.is_like_windows => {
179179
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(4).unwrap(), false)
180180
}
181181
// Generic x86
182-
("x86", _) => {
183-
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(4).unwrap(), true)
184-
}
182+
"x86" => emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(4).unwrap(), true),
185183
// Windows AArch64
186-
("aarch64", true) => {
184+
"aarch64" if target.options.is_like_windows => {
187185
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), false)
188186
}
189187
// iOS AArch64
190-
("aarch64", _) if target.target_os == "ios" => {
188+
"aarch64" if target.target_os == "ios" => {
191189
emit_ptr_va_arg(bx, addr, target_ty, false, Align::from_bytes(8).unwrap(), true)
192190
}
193-
("aarch64", _) => emit_aapcs_va_arg(bx, addr, target_ty),
191+
"aarch64" => emit_aapcs_va_arg(bx, addr, target_ty),
194192
// Windows x86_64
195-
("x86_64", true) => {
193+
"x86_64" if target.options.is_like_windows => {
196194
let target_ty_size = bx.cx.size_of(target_ty).bytes();
197195
let indirect: bool = target_ty_size > 8 || !target_ty_size.is_power_of_two();
198196
emit_ptr_va_arg(bx, addr, target_ty, indirect, Align::from_bytes(8).unwrap(), false)

0 commit comments

Comments
 (0)