Skip to content

Commit f90a602

Browse files
committed
transpile: assembly: sort positional arguments first
rust requires this
1 parent caee972 commit f90a602

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

c2rust-transpile/src/translator/assembly.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -816,6 +816,9 @@ impl<'c> Translation<'c> {
816816
_ => false,
817817
};
818818

819+
// Sort positional args before named ones.
820+
args.sort_by_key(|arg| !arg.is_positional());
821+
819822
// Add workaround for reserved registers (e.g. rbx on x86_64)
820823
let (prolog, epilog) = rewrite_reserved_reg_operands(att_syntax, arch, &mut args);
821824

0 commit comments

Comments
 (0)