File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
c2rust-transpile/src/c_ast Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -309,9 +309,10 @@ impl TypedAstContext {
309309 } ;
310310 // Sort decls by source location so we can reason about the possibly comment-containing gaps
311311 // between them.
312- let mut decls_sorted = self . c_decls . clone ( ) ;
313- decls_sorted. sort_by ( |_k1, v1, _k2, v2| v1. begin_loc ( ) . cmp ( & v2. begin_loc ( ) ) ) ;
314- for ( decl_id, decl) in & decls_sorted {
312+ let mut decls_sorted = self . c_decls_top . clone ( ) ;
313+ decls_sorted. sort_by_key ( |decl| self . c_decls [ decl] . begin_loc ( ) ) ;
314+ for decl_id in & decls_sorted {
315+ let decl = & self . c_decls [ decl_id] ;
315316 let begin_loc: SrcLoc = decl. begin_loc ( ) . expect ( "no begin loc for top-level decl" ) ;
316317 let end_loc: SrcLoc = decl. end_loc ( ) . expect ( "no end loc for top-level decl" ) ;
317318
You can’t perform that action at this time.
0 commit comments