Skip to content

Commit f10325a

Browse files
committed
transpile: use a stable sort for decls
1 parent 1cd1c92 commit f10325a

File tree

1 file changed

+2
-2
lines changed
  • c2rust-transpile/src/c_ast

1 file changed

+2
-2
lines changed

c2rust-transpile/src/c_ast/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ impl TypedAstContext {
10181018
/// we can look up the [`Translation::expr_override_tys`],
10191019
/// which are set when the macro expansion expressions are converted.
10201020
pub fn sort_top_decls_for_converting(&mut self) {
1021-
self.c_decls_top.sort_unstable_by_key(|decl_id| {
1021+
self.c_decls_top.sort_by_key(|decl_id| {
10221022
let reverse_order = match self.c_decls.get(decl_id).unwrap().kind {
10231023
CDeclKind::MacroFunction { .. } => 0,
10241024
CDeclKind::MacroObject { .. } => 1,
@@ -1033,7 +1033,7 @@ impl TypedAstContext {
10331033
/// This preserves the order when we emit the converted declarations.
10341034
pub fn sort_top_decls_for_emitting(&mut self) {
10351035
let mut decls_top = mem::take(&mut self.c_decls_top);
1036-
decls_top.sort_unstable_by(|a, b| {
1036+
decls_top.sort_by(|a, b| {
10371037
let a = self.index(*a);
10381038
let b = self.index(*b);
10391039
use Ordering::*;

0 commit comments

Comments
 (0)